python3中的绘图,用到 matplotlib,没有安装可以 pip install matplotlib 进行安装:

import matplotlib
import matplotlib.pyplot as plt   #数据可视化

matplotlib.rcParams["font.sans-serif"]=["simhei"] #配置字体 默认不支持中文
matplotlib.rcParams["font.family"]="sans-serif"

#[1]、[2]、[3]、[4]、[5]代表顺序
#[123]、[113]、[133]、[133]、[133]代表数值
#label=u"广东"  代表名称
#color="g"  代表指定的颜色
plt.bar([1],[123],label=u"广东",color="g")    #bar 树状图
plt.bar([2],[113],label=u"江苏",color="y")
plt.bar([3],[133],label=u"山东")
plt.bar([4],[133],label=u"河南")
plt.bar([5],[133],label=u"浙江")


#matplotlib("Agg")
plt.legend()   #绘制
plt.savefig("1.png")  #保存图片到本地
#plt.show()    #显示

 

相关文章:

  • 2021-11-04
  • 2021-11-11
  • 2021-08-04
  • 2021-08-16
  • 2021-09-29
  • 2021-04-21
  • 2021-10-09
  • 2021-05-07
猜你喜欢
  • 2021-05-16
  • 2021-11-16
  • 2021-12-18
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案