The expansion modules for Python scientific Computing and visualization include: NumPy, SciPy, SymPy, Matplotlib, Traits, Traitsui, Chaco, TVTK, Mayavi, Vpython, OpenCV.
The Matplotlib module relies on the NumPy module and the Tkinter module to draw various forms of graphics, including line graphs, histograms, pie charts, scatter plots, error bar graphs, and more.
Plotting a sinusoidal curve
>>> Import Numpyas NP
>>> Import Pylabas Pl
>>> t = np.arange (0.0, 2.0*np.pi, 0.01)
>>> s = np.sin (t)
>>> Pl.plot (t,s)
>>> Pl.xlabel (' x ')
>>> Pl.ylabel (' y ')
>>> pl.title (' sin ')
>>> Pl.plot (t,s)
>>> Pl.show ()
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/06/78/wKiom1m4zbqjadZiAACE70pwGpQ062.jpg-wh_500x0-wm_ 3-wmp_4-s_2150569922.jpg "title=" Untitled 1.jpg "alt=" Wkiom1m4zbqjadziaace70pwgpq062.jpg-wh_50 "/>
Plot scatter plots
>>> a = Np.arange (0, 2.0*np.pi, 0.1)
>>> B = Np.cos (a)
>>> Pl.scatter (A, B)
>>> Pl.show ()
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/A5/29/wKioL1m4zc6yl067AACjjqdY_no823.jpg-wh_500x0-wm_ 3-wmp_4-s_613188064.jpg "title=" Untitled 2.jpg "alt=" Wkiol1m4zc6yl067aacjjqdy_no823.jpg-wh_50 "/>
Plot scatter plots
>>> Import Matplotlib.pylabas Pl
>>> Import Numpyas NP
>>> x = np.random.random (100)
>>> y = np.random.random (100)
>>> pl.scatter (x,y,s=x*500,c=u ' R ', marker=u ' * ')
#s指大小, c refers to color, marker refers to the shape of the symbol
>>> Pl.show ()
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/A5/29/wKioL1m4zd3jFJCVAADhlvX1WcA561.jpg-wh_500x0-wm_ 3-wmp_4-s_2629655330.jpg "title=" Untitled 3.jpg "alt=" Wkiol1m4zd3jfjcvaadhlvx1wca561.jpg-wh_50 "/>
Modify Scatter symbols
>>> a = Np.arange (0, 2.0*np.pi, 0.1)
>>> B = Np.cos (a)
>>> Pl.scatter (a,b,marker= ' + ')
>>> Pl.show ()
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/06/78/wKiom1m4zhbgZbwsAACfaYCtU8A271.jpg-wh_500x0-wm_ 3-wmp_4-s_2707411492.jpg "title=" Untitled 4.jpg "alt=" Wkiom1m4zhbgzbwsaacfayctu8a271.jpg-wh_50 "/>
This article from the "CAS Computer Training" blog, declined to reprint!
A simple application of the Python Visual extension module matplotlib