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