1
使用代码:使用python包散景绘制直方图时,如何控制图中使用的颜色?
from bokeh.charts import Histogram, show, output_notebook
p = Histogram(df, values='score', color = 'month',
title="Histograms for two different months",
legend='top_right', bins=10)
show(p)
我提供了一个数据帧熊猫(DF)与被叫score
列和列称为month
。通过分配颜色参数color = 'month'
,使用score
创建直方图,该分组使用month
。
此代码成功绘制两个直方图,但为它们分配了红色和绿色的默认颜色。鉴于我已将month
分配给color
参数,我如何覆盖默认着色方案?