After the installation of Python, the library installed a lot of detours, looked up a lot of information, finally installed successfully, and saved the address of the article, share to everyoneMy Computer windows 7, 64-bit system, the installation of Python is 3.5, so the downloaded library is also the corresponding version of theInstallation method: Same as command line prompt, installation suffix is. whl
function : Python draw 2D graphDirectly on the code, the comments are very detailed!1 #-*-coding:utf-8-*-2 3 fromNumPyImport*4 ImportMatplotlib.pyplot as Plt5 6A=array ([0,0]); B=array ([[1,0],[0,1]])7 #generates a as mean, B is the covariance matrix, and satisfies the random number of the normal distribution8C1=random.multivariate_normal (a,b,10)#10*29C2=random.multivariate_normal (a+0.1,b+0.1,20)#20*2TenC2=mat (C2)#This is done just to illustrate t
The first thing to figure out is a concept, histogram and bar chart.The difference between a histogram and a bar chart:Bar chart is the length of the bar to indicate how many categories of frequency, its width (indicating category) is fixed;The histogram is the amount of the frequency of each group by area, the height of the rectangle represents the frequency of each group, and the width represents the group spacing of each group, so its height and width are meaningful.Because of the continuity
Workaround for _getfullpathname:emedded null character appears: (Go from http://stackoverflow.com)This was a bug in Python and not matplotlib.winreg.EnumValueThe issue is-is isn't cutting string values at their length properly for some reason, and strings would include Nu ll characters which is isn't os.path.abspath able to process.The registry entry where this happens are at SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts . Despite this isn't bein
Matplotlib is a powerful Python module for drawing two-dimensional graphics. It uses the Python language to implement the ease-of-use of the MATLAB drawing function, and has very powerful customization. It provides a complete set of command APIs similar to matlab and is suitable for interactive plotting. It can also be easily used as a drawing control and embedde
Work needs to observe the trend of data changes, with Python to write a small program to display simple charts, to share the convenience of people with the same needs, matplotlib is a very good library.#!encode=utf8 fromMatplotlibImportPyplot as PltImportSysignore_num= (int) (sys.argv[1]) Data=sys.argv[2]show_type=0ifLen (SYS.ARGV) >3: Show_type= (int) (sys.argv[3]) x=[]valid_ppl=[]train_ll=[]valid_ll=[]fi=
It is tedious to use numpy to learn statistical calculations, and a lot of data makes us very headache, so we need to visualize it graphically.Matplotlib is a Python graphics framework, similar to the MATLAB and R languages.Matplotlib's official website address is http://matplotlib.org/, for http://matplotlib.org/downloads.html, select the corresponding version can be installed, I choose the version for Matplotlib
‘)plt.legend(loc=‘upper right‘)plt.xticks((0,2,4,6,8,10),(‘1月‘,‘3月‘,‘5月‘,‘7月‘,‘9月‘,‘11月‘))plt.xlabel(‘月份‘)plt.ylabel(‘XX事件数‘)plt.grid(x1)plt.show()5. Read the hourly frequency data, draw the overlapping bar chartdata_hour2015 = pd.read_csv(‘data_hour2015.txt‘)data_hour2016 = pd.read_csv(‘data_hour2016.txt‘)plt.figure(figsize=(10, 6))data_hour2015[‘nums‘].T.plot.bar(color=‘g‘,alpha=0.6,label=‘2015年‘)data_hour2016[‘nums‘].T.plot.bar(color=‘r‘,alpha=0.4,label=‘2016年‘)plt.xlabel(‘小时‘)plt.ylabel(‘XX事
Matplotlib is a common data visualization tool used in Python, and is a bit similar to MATLAB. Calls are simple and powerful. You can install it from the command line pip install matplotlib under Windows.
Here are some examples of basic use:
1. Draw a straight line
First generate a set of data on line y = 5 * x + 5 by NumPy and then draw it on the chart
1 Import
ImportMatplotlib.pyplot as Plt#The slices would be ordered and plotted counter-clockwise.Labels ='Frogs','Hogs','Dogs','Logs'Sizes= [15, 30, 45, 10]colors= ['Yellowgreen','Gold','Lightskyblue','lightcoral']explode= (0, 0.1, 0, 0)#Only "Explode" the 2nd slice (i.e. ' hogs ')Plt.pie (sizes, explode=explode, Labels=labels, colors=colors,autopct='%1.1f%%', Shadow=true, startangle=90)#Set aspect ratio to being equal so, pie is drawn as a circle.Plt.axis ('Equal') Plt.savefig ('D:\\pie.png') plt.show
DrawingPlt.axis ([0,5,0,20]): Coordinate rangePlt.title (' PLOT ', fontsize=20): Picture titlePlt.xlable (' Row '): Row headerPlt.ylable (' COL '): column headerPlt.text (' text '): Write text in the specified coordinatesPlt.grid (True): Draw MeshPlt.plot (x, y): Line chartPlt.plot (x, Y, '-'): Line chartPlt.plot (x, y, ' o '): Scatter plotPlt.hist (x,bins=20): HistogramPlt.bar (x, y): Bar chartPlt.bar (x,y1,0.3,color= ' B ');p Lt.bar (x+0.3,y2,0.3,color= ' G '): Multi-sequence bar graphDat.plot
Import Module1 Import Matplotlib.pyplot as Plt 2 import Seaborn as SBDraw a bar chartCountplot (data: Datasets, x:x axes, color: bar colors, order: Sort)Color_palette (): Returns an RGB tuple listTest = Pd.read_csv ('Pokemon.csv')Print(Test.shape)Print(Test.tail (10))#The value_counts function counts the frequency of each sequence and descendingGeneration_order = test['generation_id'].value_counts (). IndexPrint(Generation_order)#Color_palette returns an RGB tuple listBase_color =Sb.color_palett
In order to install a matplotlib bag, for a long time, python3.4, the official does not have the corresponding version of the package, can only go to the following place under the corresponding version: http://www.lfd.uci.edu/~gohlke/pythonlibs/download Test,After the discovery of errors, as if there is a NumPy package Python 3.4 NumPy official also does not have the corresponding version, seemingly get the
Platform: win7-32 python3.4.3Installation process is really disgusting, tidy up a bit convenient for everyone, maybe search engine can be included in:The main problems encountered are:1, a variety of versions can not find compatible2, download to the. WHL . Egg file will not be installed3, installed the file and the lack of various module Importerror:no module named ' Six ' No module named ' dateutil ' importerror:no module named ' Pypars ingOK ~ Tidy up a bit, specific to see the Youdao cloud n
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.