Histogram Python Matplotlib ML AI tutorial videos 1
Histogram python matplotlib ml ai tutorial videos 1
In this video, we are going to draw a histogram with dummy data. You can the data of your choice.
You need to install matplotlib first.
pip install matplotlib
we create a dummy array like this. You can create any array
x=[22,33,63,55,75,86,76,54,32,21,12]
hist() function
with the help of hist() we will draw histogram
it take 2 parameters:
- array of data we want to plot
- Number of bars in histogram
final step is to show histogram on screen.
Here is video Video link
Source Code
<div> <div># lets create histogram in python</div> <div>import matplotlib.pyplot as plt</div> <div># now we will create array for our histogram</div> <div>x=[2,3,44,66,56,34,86,57,34,27]</div> <div># now we will use hist function to create diagram</div> <div>plt.hist(x,10)</div> <div># first values x is array we want to plot</div> <div># second value/parameter is number of bars</div> <div># now we will show it on screen</div> <div>plt.show()</div> </div>