PROGRAM -1
Write a python program to generate LINE GRAPH with suitable title and labels.
Where x is the year of performance with values 2014,2015,2016,2017,2018
and 2019 and y axis shows the profit of a particular company in Rs.(Millions).
# A program to draw line chart showing Yearly profit of a Company
import [Link] as plt
x=[]
for i in range(2014,2020):
[Link](i)
y=[10000,5000,20000,17000,12000,7000]
[Link](x,y,color='r',marker='^', markeredgecolor='b', linestyle='dashed')
[Link]()
[Link]("Year ->", fontsize=13 ,color='blue')
[Link]("Profit Rs. (in Millions)->", fontsize=13 ,color='blue')
[Link](" Yearly Profit Analysis",color='r')
[Link]()
OUTPUT :-
PROGRAM -2
Given the following data of rainfall in different zones of India in mm for 12
months. Create MULTIPLE LINE CHART in a Figure to observe any trends from
Jan to Dec.
Zones Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
North 14 13 13 19 16 20 15 7 19 17 15 12
South 16 20 13 20 20 17 11 16 13 14 17 20
# To plot a line chart
import [Link] as plt
x = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
y1 =[14,13,13,19,16,20,15,17,19,17,15,12]
y2=[16,20,13,20,20,17,11,16,13,14,17,20]
[Link](x,y1,linestyle='dashed',label='North Zone',marker='s', markeredgecolor='r')
[Link](x,y2,label='South Zone', marker='^', markeredgecolor='b')
[Link]('Month->', fontsize=13, color='red')
[Link]('Rainfall(in mm)->', fontsize=13, color='red')
[Link]('ZONE WISE RAINFALL ANALYSIS', color='blue')
[Link]()
[Link]()
[Link]()
OUTPUT :-
PROGRAM -3
Consider the data given below. Create a BAR CHART depicting the downloads
of the App.
App Name Total Downloads
VLC 197000
Spotify 209000
Tidal 414000
Netflix 196000
Kodi 272000
Hulu 311000
Audible 213000
# To plot a Bar Chart showing APP DOWNLOADS ANALYSIS
import [Link] as plt
apps = ['VLC','Spotify','Tidal', 'Netflix','Kodi','Hulu','Audible']
downloads =[197000,209000,414000,196000,272000, 311000,213000]
[Link] (apps, downloads, color='g')
[Link] ('Apps->', fontsize=12, color='green')
[Link] ('Total Downloads->', fontsize=12, color='green')
[Link] ('APP DOWNLOADS ANALYSIS', color='black')
[Link]()
[Link]()
OUTPUT :-
PROGRAM -4
Write a program in Python Pandas to create the following Data Frame
from a Dictionary. Plot a MULTIPLE BAR CHART to show the plotting of Score1
and Score2 for all Batsman.
Name Score1 Score2
1 M.S. Dhoni 95 80
2 Virat Kohli 85 92
3 Sachin 110 75
4 Kartik 75 80
# To plot multiple bar chart
import [Link] as plt
import pandas as pd
D={ 'Name':['M.S. Dhoni','Virat Kohli','Sachin','Kartik'],
'Score1':[90,65,70,80],
'Score2':[80,45,90,76],
}
df=[Link](D,index=[1,2,3,4])
print(df)
[Link](x='Name',y=['Score1','Score2'],kind='bar', rot=25)
[Link]('Cricket Score Analysis of Batsman', fontsize=17, color='r')
[Link]('Name of Batsman',fontsize=14,color="r")
[Link]('Scores',fontsize=14,color="r")
[Link]()
[Link]()
[Link]()
OUTPUT :-
Name Score1 Score2
1 M.S. Dhoni 90 80
2 Virat Kohli 65 45
3 Sachin 70 90
4 Kartik 80 76
PROGRAM -5
Given the ages of 80 participants in some game. Write a program to plot a
HISTOGRAM from given data with 6 bins of your choice.
Data=[9,10,11,13,13,15,16,17,18,19,21,23,23,23,24,24,25,25,25,25,25,26,26,
27,27,27,27,29,30,30,30,30,31,33,34,34,35,36,36,37,37,37,38,39,40,40,40,41,
42,43,43,39,30,31,32,33,34,35,36,37,38,39,36,37,38,40,41,42,43,44,45,50,51,
52,53,54,55,56,57,58]
# To plot a HISTOGRAM
import [Link] as plt
data=[ 9,10,11,13,13,15,16,17,18,19,21,23,23,23,24,24,25,25,25,25,25, 26, 26,27,27,
27, 27, 29,30,30,30,30,31,33,34,34,35,36, 36,37,37,37,38,39,40,40,40,41,
42,43,43,39,30,31,32,33,34,35,36,37,38,39,36,37,38,40,41,42,43,44,45,50
51,52,53,54,55,56,57,58 ]
b=[0,10,20,30,40,50,60]
[Link](data,bins=b,color='g',edgecolor='b')
[Link]("Participants of Game in different Age Groups",color='b', fontsize=16)
[Link]("Age interval -->",fontsize=14, color='b')
[Link]("No. of Participants -->",fontsize=14, color='b')
[Link]()
OUTPUT :-