:
Import Matplotlib.pyplot as Plt
Import NumPy as NP
x = Np.linspace (-100,100,100)
y = x**3
Plt.figure (num=3,figsize= (8,5)) #num xuhao;figsize long width
L1=plt.plot (x, Y, ' P ') # Quta is-to-return name to Plt.legend (handles)
Plt.xlim ((-100,100))
Plt.ylim (( -100000,100000))
Plt.xlabel (' X ') #x Zhou label
Plt.ylabel (' Y ')
Ax = PLT.GCA ()
ax.spines[' right '].set_color (' none ')
ax.spines[' top '].set_color (' None ') # #don ' t display border
Ax.xaxis.set_ticks_position (' Bottom ') # #set X Zhou
Ax.yaxis.set_ticks_position (' left ')
ax.spines[' Bottom '].set_position ((' data ', 0)) #y 0 postition is x position
Ax.spines[' left '].set_position (' data ', 0)
# # #tu Li
# labels can just set one label just post one line
Plt.legend (handles=l1,labels= ' y=x**3 ', loc= ' best ') # #loc =location
Plt.show ()
:
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/8E/AC/wKioL1jI3y-jTBeJAABLoHSPzSI134.png-wh_500x0-wm_ 3-wmp_4-s_2336475961.png "title=" 111111111111111.png "alt=" Wkiol1ji3y-jtbejaablohspzsi134.png-wh_50 "/>
This article is from the "Sky Blue Star" blog, please be sure to keep this source http://jingkonglanxing.blog.51cto.com/1152128/1906834
Python matplotlib generates a three-square graph of X