PyQt5: chapter10-使用Matplotlib绘制条形图

将使用matplotlib.pyplot 的以下方法

  • title():此方法用于设置图形的标题             
  • bar():从两个提供的数组绘制条形图;一个数组表示x轴的数据,第二个数组表示y轴的数据              
  • plot():此方法用于在指定的x和y坐标绘制

创建demoPlotBars.py

import matplotlib.pyplot as graph
years = ['2016', '2017', '2018']
profit = [70, 90, 80]
graph.bar(years, profit)
graph.title('Growth in Business')
graph.plot(100)
graph.show()

猜你喜欢

转载自blog.csdn.net/weixin_43307431/article/details/105982235