# 导入matplotlib库 from matplotlib import pyplot as plt # 或 # import matplotlib.pyplot as plt # 生成X轴与y轴的数值 x = [2,4,6,8,10] y = [14,23,45,66,21] # 调用函数来绘制柱形图 plt.bar(x,y) # 显示图表 print(plt.show())
转载于:https://my.oschina.net/u/3750423/blog/3070365
# 导入matplotlib库 from matplotlib import pyplot as plt # 或 # import matplotlib.pyplot as plt # 生成X轴与y轴的数值 x = [2,4,6,8,10] y = [14,23,45,66,21] # 调用函数来绘制柱形图 plt.bar(x,y) # 显示图表 print(plt.show())
转载于:https://my.oschina.net/u/3750423/blog/3070365