有没有一种方法可以在python中对同一直方图上的不同数据集重新着色



这就是我的代码行当前的样子:

plt.hist((method_a,method_b,method_c), bins=np.linspace(lb,ub,20), histtype='stepfilled', alpha = 0.5)

我希望方法a、方法b和方法c在同一直方图上有不同颜色的条形图。这可能吗?

根据文档,matplotlib的plt.hist((采用color关键字参数,您可以在其中为每个数据系列指定颜色数组,例如:

plt.hist((method_a,method_b,method_c), bins=np.linspace(lb,ub,20), color=['blur', 'red', 'green'], histtype='stepfilled', alpha = 0.5)

更多关于颜色的信息可以在这里找到

最新更新