You are on page 1of 7

Assignment No.

: 03
Name: G Khirasindhu Redy Year: 3rd

Registration No.: 180101120053 Section: Group-2

Branch: Computer Science Campus: PKD

Aim of the Experiment: Assignment of Matplotlib

Software Required: Jupyter Notebook

Crop production in India in year 2019


Season Kharif Rabi Summer Autumn Winter

Productio 303 444 507 300 600


n (in Ton)

Question 1:
Draw a scatter plot on crop production in India in year 2019 using Matplotlib.
Code:
import matplotlib.pyplot as plt
Season = ['Kharif', 'Rabi','Summer', 'Autumn', 'Winter']
Production = [303, 444, 507, 300 ,600]
plt.scatter(Season,Production)
plt.xlabel('Season')
plt.ylabel('Production')
plt.title('Crop production in India in year 2019')

plt.show()
Output:
Question 2:
Draw a line plot on crop production in India in year 2019 using Matplotlib
Code:
import matplotlib.pyplot as plt
Season = ['Kharif', 'Rabi','Summer', 'Autumn', 'Winter']
Production = [303, 444, 507, 300 ,600]
plt.plot(Season,Production,linewidth=3)
plt.xlabel('Season')
plt.ylabel('Production')
plt.title('Crop production in India in year 2019')

plt.show()
Output:
Question 3:
Draw a bar plot on crop production in India in year 2019 using Matplotlib.
Code:
import matplotlib.pyplot as plt
Season = ['Kharif', 'Rabi','Summer', 'Autumn', 'Winter']
Production = [303, 444, 507, 300 ,600]
plt.bar(Season,Production)
plt.xlabel('Season')
plt.ylabel('Production')
plt.title('Crop production in India in year 2019')

plt.show()
Output:
Question 4:
Draw a horizontal bar plot on crop production in India in year 2019 using Matplotlib.
Code:
import matplotlib.pyplot as plt
Season = ['Kharif', 'Rabi','Summer', 'Autumn', 'Winter']
Production = [303, 444, 507, 300 ,600]
plt.barh(Season,Production)
plt.xlabel('Production')
plt.ylabel('Season')
plt.title('Crop production in India in year 2019')

plt.show()
Output:
Question 5:
Draw a pie chart on crop production in India in year 2019 using Matplotlib.
Code:
import matplotlib.pyplot as plt
Season = ['Kharif', 'Rabi','Summer', 'Autumn', 'Winter']
Production = [303, 444, 507, 300 ,600]
plt.pie(Production,labels=Season,autopct='% d%%')
plt.title('Crop production in India in year 2019')

plt.show()
Output:
Question 6:
Draw a bubble plot on crop production in India in year 2019 using Matplotlib.
Code:
import matplotlib.pyplot as plt
Season = ['Kharif', 'Rabi','Summer', 'Autumn', 'Winter']
Production = [303, 444, 507, 300 ,600]
plt.scatter(Season,Production,s=Production, c=Production, alpha=1)
plt.xlabel('Season')
plt.ylabel('Production')
plt.title('Crop production in India in year 2019')

plt.show()
Output:

You might also like