1 / 10

MATPLOTLIB-PART 2

Setting lines ,changing colors and adding markers are some of the features of matplotlib .Different styles of lines can also be used to plot .Special plots can also be drawn using Matplotlib.Here is the highlight on these topics.<br>To learn more visit: http://bit.ly/DatascienceCourse

Download Presentation

MATPLOTLIB-PART 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MATPLOTLIB PART II

  2. The following format string characters are accepted to control the line style or marker: character description'-‘ solid line style'--‘ dashed line style'-.‘ dash-dot line style':‘ dotted line style'.‘ point marker',‘ pixel marker'o‘ circle marker'v‘ triangle_down marker'^‘ triangle_up marker'<‘ triangle_left marker'>‘ triangle_right marker'1‘ tri_down marker'2‘ tri_up marker'3‘ tri_left marker'4‘ tri_right marker's‘ square marker'p‘ pentagon marker'*‘ star marker'h‘ hexagon1 marker'H‘ hexagon2 marker'+‘ plus marker'x‘ x marker'D‘ diamond marker'd‘ thin_diamond marker'|‘ vline marker‘_‘ hline marker

  3. There are several parameters that determine what the figure looks like:

  4. Example • fig = plt.figure() axes1 = fig.add_axes([0.1, 0.1, 0.9,0.9])  axes1.plot(arr1, arr2, 'b--') axes1.plot(arr2, arr1, 'r.-') • O/P:

  5. Alpha parameter can be mentioned that defines the transparency in the plot. • Eg: fig = plt.figure() axes1 = fig.add_axes([0.1, 0.1, 0.9,0.9])   axes1.plot(arr1, arr2, color = '#808000',  lw = 10) axes1.plot(arr2, arr1, color = '#00FF00',  lw = 0.25) axes1.plot(arr1, arr1*2, color = '#00FF00',  lw = 1)

  6. Setting line,changing line colors and adding markers The following color abbreviations are supported: Character color ‘b’ blue ‘g’ green ‘r’ red ‘c’ cyan ‘m’ magenta ‘y’ yellow ‘k’ black ‘w’ white For other color shades hexadecimal color coding can be used.

  7. O/P:

  8. Ls parameter defines the line style as mentioned in the previous table . • Lw defines the line width that we wish to have in the plot • Eg:fig = plt.figure() axes1 = fig.add_axes([0.1, 0.1, 0.9,0.9])  #l,b,w,h -[0 and 1] axes1.plot(arr1, arr2, color = '#808000', lw = 10, ls = '--')axes1.plot(arr2, arr1, color = '#00FF00', lw = 3.25, ls = ':')axes1.plot(arr1, arr1*2, color = '#00FF00', lw = 1, ls = '-.')

  9. O/P:

  10. Eg 2:fig = plt.figure()axes1 = fig.add_axes([0.1, 0.1, 0.9,0.9])   #l,b,w,h -[0 and 1]axes1.plot(arr1, arr1*2, color = '#00FF00', lw = 1, ls = '.', marker= 's', markersize = 10, markerfacecolor = 'red') • O/P:

More Related