import matplotlib.pyplot as plt
labels = ['2001', '2002', '2003', '2004', '2005']
men_means = [20, 35, 30, 35, 27]
women_means = [25, 32, 34, 20, 25]
men_std = [2, 3, 4, 1, 2]
women_std = [3, 5, 2, 3, 3]
width = 0.35
fig, ax = plt.subplots()
ax.bar(labels, men_means, width, yerr=men_std, label='Pria')
ax.bar(labels, women_means, width, yerr=women_std, bottom=men_means,
label='Wanita')
ax.set_ylabel('Nilai')
ax.set_title('Contoh Grafik Bar Bertingkat')
ax.legend()
plt.show()
Cara Membuat Grafik Bar Bertingkat Python Matplotlib
June 06, 2022
0
Berikut adalah kodingan cara membuat grafik bar bertingkat Python Matplotlib dan hasilnya akan seperti gambar berikut :
Tags