【发布时间】:2020-02-02 08:04:10
【问题描述】:
我正在尝试更改 plotly 中的背景颜色,但使用布局功能后,我在 plotly 中缺少标题。
layout = Layout(
paper_bgcolor='rgba(0,0,0,0)',
plot_bgcolor='rgba(0,0,0,0)'
)
data['Country'].value_counts()[:10][::-1].iplot(kind="barh",bargap=.5, title="Top 10 countries faced terrorist attacks", colors="#182844", layout=layout)
【问题讨论】:
-
我的建议对你有什么效果?
-
@vestland 我尝试将布局添加到 iplot 本身并且它有效。我们也可以随之调整边距。
-
示例代码:
data['Region'].value_counts()[1:10][::-1].iplot(kind="barh",bargap=.5, title="Top 10 cities faced terrorist attacks", colors="mediumorchid", layout=Layout(paper_bgcolor='rgba(0,0,0,0)', plot_bgcolor='rgba(0,0,0,0)', width=800, height=500, title='Top 10 Region faced terrorist attacks')) -
酷!请考虑将其作为答案而不是评论!