In [1]:
import matplotlib.pyplot as plt
cat = [''''Jan'''',''''Feb'''',''''Mar'''',''''Apr'''']
val = [7,8,3,4]
plt.bar(cat, val)
plt.xlabel(''''2024'''')
plt.ylabel(''''Val'''')
plt.title(''''Bar Chart'''')
plt.show()
In [2]:
import matplotlib.pyplot as plt
import numpy as np
categories = [''''A'''', ''''B'''', ''''C'''', ''''D'''', ''''E'''']
series1 = [5, 7, 8, 5, 6]
series2 = [6, 9, 5, 7, 8]
series3 = [4, 6, 7, 8, 5]
n = len(categories)
ind = np.arange(n)
width = 0.25
plt.bar(ind, series1, width, label=''''Series 1'''')
plt.bar(ind + width, series2, width, label=''''Series 2'''')
plt.bar(ind + 2 * width, series3, width, label=''''Series 3'''')
plt.title(''''Bar Chart with Multiple Series'''')
plt.xlabel(''''Category'''')
plt.ylabel(''''Values'''')
plt.legend()
plt.xticks(ind + width, categories)
plt.show()