matplotlib (a)

Draw a simple polyline:

 

 

code show as below:

Coding #:. 8 UTF- 
Import matplotlib.pyplot AS PLT
Import numpy AS NP
# pre-DATAS
Y1 = [ 0, . 1, 2, . 3, . 4, 18 is, . 6, . 7, . 8, . 9]
Y2 = [ 30, 12 is, 12 is, 67, 14, 15, 45, . 17, 18 is, . 19]
X = np.arange ( . 1, . 11, . 1) # X coordinate
Print (X)
plt.plot (X, Y1, LW = . 1, C = ' Red ', marker = ' S ', MS = . 4, label = ' 1 the Y-axis') # y1 drawing
plt.plot (X, Y2, LW = . 1, C = 'G', marker = 'O', label = '2 the Y-axis') # draw Y2
# PLT-style
plt.xticks (X) scale # x-axis
plt.xlim ( 0.5, 10.5) # X-axis coordinate range
plt.ylim ( 0, 100) # Y-axis coordinate range
plt.xlabel ( 'X--the Name') # X axis denoted
plt.ylabel ( 'the Y-the Name') # y-axis label
plt.legend () # Legend
plt.savefig ( "D: \ est.png") # save the image
plt.show ()


plt.plot(x, y1, lw=1, c='red', marker='s', ms=4, label='Y1'): C represents the color, marker represents the node shape, ms represents the marker size, label name is discounted 
Shape list:

 

 



Guess you like

Origin www.cnblogs.com/zhouzetian/p/11609659.html