Python_ display a set of data as a histogram (for example, list)

Source: Internet
Author: User

directly on the code:
1  fromMatplotlibImportPyplot as Plt2 3 #parameters are list, header, x-axis label, y-axis label, XY axis range4 defdraw_hist (Mylist,title,xlabel,ylabel,xmin,xmax,ymin,ymax):5Plt.hist (mylist,100)6 Plt.xlabel (Xlabel)7 Plt.xlim (Xmin,xmax)8 Plt.ylabel (Ylabel)9 Plt.ylim (Ymin,ymax)Ten Plt.title (title) One plt.show () A  -  -Draw_hist (Arealist,'areaslist',' Area',' Number', 50.0,250,0.0,8)#Histogram display theDraw_hist (Perimeterlist,'perimeterlist',' Area',' Number', 40.0,80,0.0,8)
View Code

The results are as follows:

Convenient and fast, need to see a set of data distribution frequency, you can use the above method.

Python_ display a set of data as a histogram (for example, list)

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.