matplotlib (1) - figure created

. 1  Import matplotlib.pyplot AS PLT
 2  Import numpy AS NP
 . 3  
. 4 X = np.linspace (-3,. 3, 50 )
 . 5 Y1 = X + 2 *. 1
 . 6 Y2 = X ** 2
 . 7  
. 8  # Figure. 1 
. 9  PLT. figure ()
 10  plt.plot (X, Y1)
 . 11  
12 is  # figure 2 
13 is  plt.figure ()
 14  plt.plot (X, Y2)
 15  
16  # figure. 4, the figure designated number and specify the size of the figure 
. 17 PLT. Figure (NUM =. 4, figsize = (. 8,. 5 ))
 18 is plt.plot (X, Y1, Color = " Red" , As linewidth = 5.0, lineStyle = ' - ' )     # Specify line color, width and type 
. 19  plt.plot (X, Y2)
 20 is  
21 is plt.show ()

 

Guess you like

Origin www.cnblogs.com/guoruxin/p/11247040.html