Programs on Matplotlib
CUSTOMIZING LINE CHART: PLOT
# week ,temp ,humidity graph
import [Link] as plt
w=[1,2,3,4,5,6,7,8]
t=[28,34,36,30,32,38,34,32]
h=[30,32,34,28,30,35,33,30]
[Link](w,t,'r',linestyle='-.')
[Link](w,h,'b',linestyle=':')
[Link]()
OUTPUT :
BAR CHART
Import [Link] as plt
x=[2016,2017,2018,2019,2020]
y=[55,46,30,50,40]
[Link](x,y)
[Link]()
OUTPUT :
CUSTOMIZING BAR CHART
# bar chart for year & pass % students
import [Link] as plt
year=[2018,2019,2020,2021]
pas=[28,34,36,30]
# plotting horizontal graph
[Link](year,pas,color='b')
[Link]()
OUTPUT :
HISTOGRAM CHART : hist()
import [Link] as plt
data=[2,4,5,6,2,6,8,10,12,12,11,10,4,3,2,5,7,9,11
,12,13,14,15,14,10,9,7,9]
#Plotting Histogram
[Link](data)
#Displaying Graph
[Link]()
OUTPUT :
CUSTOMIZING HISTOGRAM CHART
#Histogram for age of students
import [Link] as plt
data=[2,4,5,6,2,6,8,10,12,12,11,10,4,3,2,5,7,9,11
,12,13,14,15,14,10,9,7,9]
#Histogram with 4 ranges and x-ticks
[Link](data,bins=[0,4,8,12,16])
[Link]([0,4,8,12,16])
[Link]()
OUTPUT :