CBSE Class 12 Informatics Practices Question 122 of 147

Plotting with Pyplot — Question 5

Back to all questions
5
Question

Question 3

Write a program to add titles for the X-axis, Y-axis and for the whole chart in below code.

import matplotlib.pyplot as plt
Months = ['Dec', 'Jan', 'Feb', 'Mar']
Attendance = [70, 90, 75, 95]
plt.bar(Months, Attendance)
plt.show()
Answer
import matplotlib.pyplot as plt
Months = ['Dec', 'Jan', 'Feb', 'Mar']
Attendance = [70, 90, 75, 95]
plt.bar(Months, Attendance)
plt.xlabel('Months')  
plt.ylabel('Attendance')
plt.title('Attendance Report')

plt.show()
Output
Write a program to add titles for the X-axis, Y-axis and for the whole chart in below code. Plotting with Pyplot, Informatics Practices Computer Science Sumita Arora Solutions CBSE Class 12