【发布时间】:2021-04-09 07:05:56
【问题描述】:
我需要像这样在 python 中使用 matlib.plot 绘制图形:
实际上我使用的是绘制所有条形图的代码
bars = ('Optimum CPLEX', 'eUCB', 'ONETS', 'e-greedy')
y_pos = [1, 3, 5, 7]
y_pos_2 = [2, 4, 6, 8]
plt.ylabel('Average Reward \u03B7_i')
plt.suptitle('Optimal Model versus Heuristics')
name = 'grafics/11_reward_utilization.png'
# Create bars
plt.bar(y_pos, reward, color=['blue', 'blue', 'blue', 'blue'])
plt.bar(y_pos_2, utilization, color=['yellow', 'yellow', 'yellow', 'yellow'])
# Create names on the x-axis
plt.xticks(y_pos, bars)
# Show graphic
plt.savefig(name, transparent = True)
plt.show()
但结果我收到了一个包含所有条形但尺寸相同的图形,如下所示:
有人知道我如何在 y 轴上绘制这两个不同维度数据的图形吗?
谢谢。
【问题讨论】:
标签: python