1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| import matplotlib.pyplot as plt import numpy as np plt.figure(figsize=(8, 6), dpi=100) plt.subplot(1, 1, 1) N = 6 values = (250, 320, 340, 200, 410, 500) index = np.arange(N) width = 0.65 p2 = plt.bar(index, values, width, label="rainfall", color="#87CEFA") plt.xlabel('Months') plt.ylabel('rainfall (mm)') plt.title('Monthly average rainfall') plt.xticks(index, ('Jan', 'Fub', 'Mar', 'Apr', 'May', 'Jun')) plt.yticks(np.arange(0, 810, 100)) plt.legend(loc="upper right") plt.show()
|