python如何调用matplotlib生成堆积条形图

使用matplotlib生成堆积条形图很简单,只需要使用matplotlib.pyplot模块中的plt.bar()函数即可:import matplotlib.pyplot as plt# Data to plot labels = 'A', 'B', 'C', 'D' sizes = [15, 30, 45, 10]# Generate stacked bar chart plt.bar(labels, sizes, stacked=True)# Display chart plt.show()

猜你喜欢

转载自blog.csdn.net/weixin_35754962/article/details/129529764