Matplotlib PDF
Matplotlib PDF
Q2)Write programs to understand the use of Matplotlib for Working with Multiple Figures and Axes, Adding Text,
Adding a Grid and Adding a Legend.
import numpy as np
import matplotlib.pyplot as plt
# data to plot
n_groups = 5
men_means = (22, 30, 33, 30, 26)
women_means = (25, 32, 30, 35, 29)
# create plot
fig, ax = plt.subplots()
index = np.arange(n_groups)
bar_width = 0.35
opacity = 0.8
plt.xlabel('Person')
plt.ylabel('Scores')
plt.title('Scores by person')
plt.xticks(index + bar_width, ('G1', 'G2', 'G3', 'G4', 'G5'))
plt.legend()
plt.tight_layout()
plt.show()
Q3)Write programs to understand the use of Matplotlib for Working with Line Chart, Histogram, Bar Chart, Pie Charts.