MATPLOTLIB (1) PowerPoint PPT Presentation

presentation player overlay
About This Presentation
Transcript and Presenter's Notes

Title: MATPLOTLIB (1)


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'lt triangle_left
    marker'gt 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, co
    lor  '808000', 
  • lw  10) axes1.plot(arr2, arr1, color  '0
    0FF00', 
  • lw  0.25) axes1.plot(arr1, arr12, 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
  • Egfig  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  '0
    0FF00', lw  3.25, ls  '')axes1.plot(arr1, arr1
    2, color  '00FF00', lw  1, ls  '-.')

9
  • O/P

10
  • Eg 2fig  plt.figure()axes1  fig.add_axes(0.1
    , 0.1, 0.9,0.9)  
    l,b,w,h -0 and 1axes1.plot(a
    rr1, arr12, color  '00FF00', lw  1, ls  '.', 
    marker 's', markersize  10, markerfacecolor  'r
    ed')
  • O/P
Write a Comment
User Comments (0)
About PowerShow.com