import matplotlib.pyplot as plt import seaborn as sns # 数据准备 x = ['Cat1', 'Cat2', 'Cat3', 'Cat4', 'Cat5'] y = [5, 4, 8, 12, 7] # 用 Matplotlib 画条形图 plt.bar(x, y) plt.show() # 用 Seaborn 画条形图 sns.barplot(x, y) plt.show()
Matplotlib效果:
Seaborn效果: