Python data analytics drawing experience

Source: Internet
Author: User
Tags cos

For numpy functions, pands and so on, is not very familiar, I will copy the code, tap, look for feelings.

The default import Package
Import NumPy as NP
Import Matplotlib.pyplot as Plt

DefPrint_line_draw(): "" "Draw Straight Return:" "X=Np.Arange(0,9,1)Y=X+8Plt.Plot(X,Y,color= "red" linestyle=,= "*" ,label=< span class= "str" > ' y=x+8 ' )  Plt. ( "1.png" ,dpi= 60)  Plt. ()  Plt. ()               

DefPrint_pie_draw(): "" "Draw Pie Return:" " #指定切片大小比例Sclice=[2,3,5,8] #指定标签Activite=["Sleep","Eating","Study","Work"] #颜色Color=[' B ',' m ',' R ',' W ']Plt.Pie(Sclice,Labels=Activite,Colors=Color,StartAngle=0, Shadow=true, Explode= (0,0.2 ,0,0),  Autopct= '%1.1f%% ' ) . Title ( "Activite Analys"  PLT savefig ()  plt< Span class= "pun". show ()             

DefPrint_scatter_draw():    "" "Draw scatter Plot return:" "X=Np.Random.Rand(1000)Y=Np.Random.Rand(Len(X)) #绘图Plt.Scatter(X,Y,Color= ' B ' ,label=  "scatter draw" , Alpha= 0.3,marker= "P"  Plt. ()  Plt. ( "3.png" ,dpi= 60)  Plt. () print_scatter_draw ()      

DefPrint_hist_draw():    "" "Picture Histogram" ""X=Np.Random.Randint(1,800,300)Axit=Plt.Gca() #得到当前绘图对象Axit.hist(X,Bins=35,Facecolor=' R ',Normed=True,histtype= "bar" ,< Span class= "PLN" >alpha=0.5)  Axitset_xlabel ( "values" ) . Set_title)  Plt . savefig (,dpi< Span class= "pun" >=150)  Plt. Show ()               

This one's not written as a function.

ImportNumPyAsNpImportMatplotlib.PyplotAsPltx=Np.Linspace(0,10,1200)Y=Np.Sin(X)+1Z=Np.Cos(X**2)+1#设置图像大小Plt.Figure(Figsize=(8,6))Plt.Plot(X,Y,Label=' $\cosx+1$ ',Color="Red",LineWidth=2)Plt.Plot(X,Z,Label=' $\cos x^2+1$ ')#设置x轴Plt.Xlabel("Time (s)")Plt.ylabel (plt< Span class= "pun". title () plt< Span class= "pun". ylim (0,2 plt. () plt. ( "5.png" ,dpi= 120) plt. ()               

Copy of the article
Introduction to Matplotlib Data mining

Find Python code pasted in the past, because indentation, need to be re-modified, a little trouble
Baidu Cloud source sharing, download down, experience running it.

Axis, no calibration, with my MMA, take a look at the last image.

The most favorite MMA, is still very powerful, several to solve a problem.

Python data analytics drawing experience
In MU class network, as if the picture shows a problem, I modify MARKD also not,
To see the modified image, click on the link forklift rental

Python data analytics drawing experience

Related Article

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.