Python matplotlib generates a three-square graph of X

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.