【发布时间】:2019-03-05 19:40:50
【问题描述】:
我正在尝试更改我在 python 中使用 plotly 和 cufflinks 绘制的堆栈条形图的颜色(cufflinks 库允许直接从数据帧中绘制图表,这非常有用)。
我们看下图(我用的是jupyter notebook):
import plotly.plotly as py
import cufflinks as cf
cf.set_config_file(offline=True, world_readable=True, theme='white')
df = pd.DataFrame(np.random.rand(10, 4), columns=['A', 'B', 'C', 'D'])
df.iplot(kind='bar', barmode='stack')
如何使用上述代码实现新的调色板?我想使用“Viridis”调色板。我还没有找到一种方法来修改图形的颜色或使用调色板自动为条形图的不同堆栈着色。你们中有人知道怎么做吗?
非常感谢您的帮助,
【问题讨论】:
标签: python pandas colors plotly