0% found this document useful (0 votes)
21 views2 pages

Data Visualization with Python Charts

The document provides instructions and code snippets for plotting various types of graphs using Matplotlib in Python, including line graphs, bar graphs, scatter plots, histograms, and pie charts. Each section includes the data to be plotted and the corresponding code to generate the visualizations. The examples cover different types of data representation, demonstrating how to use Matplotlib effectively.

Uploaded by

v.daksh.9308
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views2 pages

Data Visualization with Python Charts

The document provides instructions and code snippets for plotting various types of graphs using Matplotlib in Python, including line graphs, bar graphs, scatter plots, histograms, and pie charts. Each section includes the data to be plotted and the corresponding code to generate the visualizations. The examples cover different types of data representation, demonstrating how to use Matplotlib effectively.

Uploaded by

v.daksh.9308
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PRACTICAL QUESTIONS

1. LINE GRAPH
Plot a line chart using the given data
X aixis =3,4,6,2,8
Y axis=9,10,8,7,6
CODE
import [Link] as plt
import numpy as np
x=[Link]([3,4,6,2,8])
y=[Link]([9,10,8,7,6])
[Link](x,y)
[Link]()

2. BAR GRAPH
Plot a bar graph using the given data
No of people voted=23,45,31,40,35
Area covered=a1,a2,a3,a4,a5

CODE

import [Link] as plt


x=['a1','a2','a3','a4','a5']
y=[23,45,31,40,35]
[Link](x,y,color='red')
[Link]('Bar graph')
[Link]('Area coverd')
[Link]('No of people voted')
[Link]()

3. SCATTER PLOT
Plot a scatter plot from the given data
temp=[14.2,16.4,11.9,15.2,18.5,22.1,19.4,25.1,23.4,18.1,22.6,17.2]
sales=[215,325,185,332,406,522,412,614,544,421,445,408]
CODE
import [Link] as plt
temp=[14.2,16.4,11.9,15.2,18.5,22.1,19.4,25.1,23.4,18.1,22.6,17.2]
sales=[215,325,185,332,406,522,412,614,544,421,445,408]
[Link](temp,sales,c='blue')
[Link]('scatterplot')
[Link]("Tempreture")
[Link]("Sales")
[Link]()
[Link]
plot a histogram from the given data
x=[19,16,28,45,37,34,13,49,42,44]
y=[10,20,30,40,50]
CODE

import [Link] as plt


x=[19,16,28,45,37,34,13,49,42,44]
y=[10,20,30,40,50]
[Link](x,y,color='red')
[Link]('Histogram')
[Link]('Marks')
[Link]('No of students')
[Link]()
4. PIE CHART
Plot a pie chart on the given data
y = [Link]([35, 25, 25, 15])
mylabels = ["Apples", "Bananas", "Cherries", "Dates"]

CODE

import [Link] as plt


import numpy as np
y = [Link]([35, 25, 25, 15])
mylabels = ["Apples", "Bananas", "Cherries", "Dates"]
[Link](y, labels = mylabels)
[Link]()

You might also like