Download as odp, pdf, or txt
Download as odp, pdf, or txt
You are on page 1of 11

WELCOME TO PYTHON PROGRAMMING

LANGUAGE
HISTOGRAM
MATPLOTLIB IN PYTHON
§ Matplotlib in Python is a package that is used for displaying the 2D graphics. The Matplotlib
can be used in python scripts, shell, web application servers and other GUI toolkits. Python
provides different types of plots such as Bar Graph, Histogram, Scatterplot, Area plot, Pie
plot for viewing the data
Types of matplotlib:
§ Bar chart
§ Scatterplot
§ Histogram
§ Pie chart
§ Area plot
§
WHAT IS HISTOGRAM ?
A histogram is a graphical representation of data points organized into user-specified ranges. Similar in
appearance to a bar graph, the histogram condenses a data series into an easily interpreted visual by
taking many data points and grouping them into logical ranges or bins.
GRAPHICAL REPRESENTATION
OF HISTOGRAM
KEY FEATURES
§ A histogram is a bar graph-like representation of data that buckets a range of classes into
columns along the horizontal x-axis. The vertical y-axis represents the number count or
percentage of occurrences in the data for each column Columns can be used to visualize
patterns of data distributions. In trading, the MACD histogram is used by technical analysts
to indicate changes in momentum. The MACD histogram columns can give earlier buy and
sell signals than the accompanying MACD and signal lines.
HOW HISTOGRAM WORKS ?
§ Histograms are commonly used in statistics to
demonstrate how many of a certain type of
variable occur within a specific range. For
example, a census focused on the
demography of a town may use a histogram
to show how many people are between the
ages of zero – 10, 11 – 20, 21 – 30, 31 – 40,
41 – 50, 51 -60, 61 – 70, and 71 – 80.
CREATE A HISTOGRAM
§ Create Histogram: In Matplotlib, we use the hist() function to create histograms. The hist() function
will use an array of numbers to create a histogram, the array is sent into the function as an
argument.
§

1. Input value >>>Interval>>>Count of values>>>Represent The data using Bars


PARAMETERS OF HISTOGRAM

§ Hist(x,bins=none,range=none, density=false,
weight=none, cumulative=false, bottom
=none,histtype='bar’,align='mid’,
orientation='vertical’,rwdata=none,**kwar
g)
AGE DISTRIBUTION USING
HISTOGRAM
§ import matplotlib.pyplot as plt ages = [12, 13, 15, 19, 20, 20, 24, 26, 32, 39, 49] plt.hist(ages)
plt.xlabel("Age") plt.ylabel("Age Disribution") plt.title("Age Distribution Histogram")
plt.show()
NANDRI
VANAKKAM

You might also like