Library - Matplotlib

Back to Course

Lesson Description

Lession - #511 matplotlib Histogram

A histogram is an accurate representation of the conveyance of mathematical information. It is a gauge of the likelihood conveyance of a persistent variable. It is a sort of visual chart.

To develop a histogram, follow these means −

1. Bin the scope of values.
2. Partition the whole scope of values into a progression of stretches.
3. Count the number of values that fall into every stretch.

The containers are typically indicated as sequential, non-covering time periods variable.

The matplotlib.pyplot.hist(>
work plots a histogram. It processes and draws the histogram of x.

    from matplotlib import pyplot as plt
import numpy as np
fig,ax = plt.subplots(1,1>
a = np.array([22,87,5,43,56,73,55,54,11,20,51,5,79,31,27]>
ax.hist(a, bins = [0,25,50,75,100]>
ax.set_title("histogram of result">
ax.set_ylabel('no. of students'>