fork download
  1. # 数据模拟代码(示意)
  2.  
  3. import matplotlib.pyplot as plt
  4.  
  5. # 设置字体为SimHei,确保该字体在你的系统中存在
  6. plt.rcParams['font.sans-serif'] = ['SimHei'] # 指定默认字体
  7. plt.rcParams['axes.unicode_minus'] = False # 解决保存图像时负号'-'显示为方块的问题
  8.  
  9. metrics = {
  10. '处理能力': [3.2, 5.8], # 万吨/日
  11. 'COD达标率': [0.68, 0.93],
  12. '投诉量': [127, 19], # 件/季度
  13. '运维成本': [2.1, 1.6] # 元/吨
  14. }
  15.  
  16. fig, axs = plt.subplots(2,2)
  17. for i, (k,v) in enumerate(metrics.items()):
  18. ax = axs[i//2, i%2]
  19. ax.bar([' 治理前','治理后'], v, color=['#ff7f0e','#1f77b4'])
  20. ax.set_title(k)
  21.  
  22. plt.show()
Success #stdin #stdout #stderr 4.41s 69324KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Fontconfig error: No writable cache directories