How to Plot Histogram in Matplotlib

Machine Learning courses with 100+ Real-time projects Start Now!!

Program 1

import matplotlib.pyplot as mat
prod_price=[0,10,25,30,70,100,150,400,350,500,700]
prod_range=[0,30,100,150,300,500,800]
mat.hist(prod_price,prod_range,rwidth=0.3,histtype="bar",facecolor='r')
mat.xticks([0,30,50,100,300,500,800])
mat.title("Product Price Range")
mat.xlabel("Product Price")
mat.ylabel("Product Range")
mat.show()

 

Did you like this article? If Yes, please give DataFlair 5 Stars on Google

courses
Image

TechVidvan Team

TechVidvan Team provides high-quality content & courses on AI, ML, Data Science, Data Engineering, Data Analytics, programming, Python, DSA, Android, Flutter, full stack web dev, MERN, and many latest technology.

Leave a Reply

Your email address will not be published. Required fields are marked *