0% found this document useful (0 votes)
8 views

Data Visualization

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Data Visualization

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Data Visualization

Presented by
Mrs. Susmita Cholkar
Learning Objective
Introductions to Data
Visualization Matplotlib Bar Graph Histogram Pie
Library and its advantages Chart
Line Plot

Frequency Polygon Box


Scatter Plot
Plot

Matplotlib -How to save


the plot
Data visualization
Is the technique to present the data in a pictorial or graphical format.
It enables stakeholders and decision makers to analyze data visually.
The data in a graphical format allows them to identify new trends and
patterns easily.
• The main benefits of data visualization are as
follows:
• It simplifies the complex quantitative information
• It helps analyze and explore big data easily It
identifies the areas that need attention or
improvement
• It identifies the relationship between data points
and variables It explores
new patterns and reveals hidden patterns in
the data
Three major considerations for Data
Visualization

Clarity Accuracy Efficiency


Advantages of Matplotlib
• Matplotlib is python two-dimensional plotting library for data visualization and creating interactive
graphics or plots. Using pythons matplotlib, the data visualization of large and complex data becomes
easy.

• There are several advantages of using matplotlib to visualize data.



• A multi-platform data visualization tool built on the numpy and sidepy framework.
Therefore, it's fast and efficient.

• It possesses the ability to work well with many operating systems and graphic backends.

• It possesses high-quality graphics and plots to print and view for a range of graphs such as
histograms, bar charts, pie charts, scatter plots and heat maps.
• It has full control over graph or plot styles such as line properties, thoughts, and access
properties
LinePlot

• The line chart/plot is represented by a series of


data points connected with a straight line
.
• A line chart or line graph can be created using the
plot() function.
• We can not only just plot a line but we can explicitly
define the grid, the x and y-axis scale and labels,
title and display options.
Line Chart

Customisations of Line plot:


Customizations of Line plot:
Color used to change the line color

Marker used to set Marker Type like('*','+', 'x',' .' etc.)

Markersize used to set the marker size and it is to specified in points.

Markeredgecolor used to specify the marker edge color by default it take the
same color as the line.
Linestyle used to change the line style such as 'solid I dashed',
'dashdot',
'dotted')

Linewidth used to adjust the width of the line around the bar
Multiple Line Graph with Customizations
Bar graph
•Bar graph represents the data using bars either in Horizontal or
Vertical directions. Bar graphs are used to show two or more values
and typically thexis should be categorical data. The length of the bar
is proportional to the counts of the categorical variable on x-axis.

• Function:

• The function used to show bar graph is 1plt.bar()'
• The bar() function expects two lists of values one on x-
coordinate and another on y-coordinate
BAR Graph
Customization of Bar Graph
BAR Graph
You can also specify different colors for different bars, edge­-color & width.
Multiple bar charts

•We can plot multiple bar charts by playing with the thickness and the positions of

the bars. The data variable contains three series of four values.

The following code will show three bar charts of four bars.
•The bars will have a thickness of 0.25 units.

•Each bar chart will be shifted 0.25 units from the previous one.

•The data object is a multidict containing number of students passed in three subjects of a school

over the last four years.


Multiple Bar Cart
Horizontal Bar Graph
• barh() is used to draw horizontal bar graph.
Histogram
•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.
•The towers or bars of a histogram are called bins. The height of each bin shows how many values from that data fall
into that range. The default value of the number of bins to be created in a histogram is 10. However, we can change the
size of bins using the parameter bins in matplotlib.

•To construct a histogram, follow these steps -


• Bin the range of values.
• Divide the entire range of values into a series of intervals.
• Count how many values fall into each interval.
• The bins are usually specified as consecutive, non-overlapping intervals of a
variable.
• The matplotlib.pyplot.hist() function plots a histogram. It computes and draws the
histogram of x.
The following table lists down the parameters for a histogram -

X ARRAY OR SEQUENCE OF ARRAYS


bins integer or sequence or 'auto', optional
optional parameters
range The lower and upper range of the bins.
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.
hlsttype 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 top of
each other.
• 'step' generates a lineplot that is by default unfilled.
• 'stepfilled' generates a lineplot that is by default filled.

You might also like