Practical File Program
Practical File Program
import matplotlib.pyplot as pl
labels = ["Car","Public Transit", "Walking", "Bicycle"]
sizes = [40,30,20,10]
colors=['green','c','lightgreen','yellow']
pl.figure(figsize=(6,6))
pl.pie(sizes,labels=labels,colors=colors,autopct='%1.1f%%')
pl.axis('Equal')
pl.title("Mode of Transportaion")
pl.show()
#Write a program to draw a scatter chart to visualize the comparative rainfall data for 12 months in
Tamil Nadu using the CSV file "rainfall.csv".
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
df=pd.read_csv("rainfall.csv")
x=df ['Months']
y=df['Rainfall']
plt.figure(figsize=(5,3))
plt.figure(figsize=(6,4))
colors = np.array([0, 10, 20, 30, 40, 45, 50, 60, 70, 80, 90, 100])
plt.scatter(x,y,c=colors,cmap='viridis')
plt.title("Rainfall data of Tamil Nadu", fontname='Calibri',
color='m',fontsize=16)
plt.xticks(rotation = 45)
plt.xlabel("Months", fontname='Calibri', color='b',fontsize=12)
plt.ylabel("Rainfall (cm)", fontname='Calibri', color='b',fontsize=12)
plt.show()
import matplotlib.pyplot as pl
a=[141, 145, 142, 147, 144, 148, 141, 142, 149, 144, 143, 149, 146,
141, 147, 142, 143]
pl.ylabel("Number of Girls")
pl.xlabel("Height")
pl.title(" Heights of Girls in class-XII")
pl.hist(a)
pl.show()