Experiment No.3(Dv)
Experiment No.3(Dv)
3
Aim :Use A Data Visualization Library Such As Matplotlib Or Seaborn To
Create A Histogram And Plot The Histogram, Ensuring Appropriate Labelling
Of The X-Axis, Y-Axis, And Title To.
THEORY:
A histogram is an accurate representation of the distribution of numerical data. It is
an estimate of the probability distribution of a continuous variable. It is a kind of bar
graph.
To construct a histogram, follow these steps −
Parameters
The following table lists down the parameters for a histogram −
optional parameters
density If True, the first element of the return tuple will be the counts normalized to form
a probability density
cumulative If True, then a histogram is computed where each bin gives the counts in that bin
plus all bins for smaller values.
histtype
The type of histogram to draw. Default is ‘bar’
• ‘bar’ is a traditional bar-type histogram. If multiple data are given the bars
are arranged side by side.
• ‘barstacked’ is a bar-type histogram where multiple data are stacked on
CODE.1: In this example, we will create a simple histogram using the hist() function with
the default parameters. The term ‘default parameters’ means that we will only pass the data as
the parameters to the hist() function in Matplotlib, all the other parameters will get a default
value.
O/P:
CODE 2:
Output: