-1

我的条形图设置为蓝色的默认颜色,所以我想将其更改为橙色。我需要对我的代码进行哪些更改,以便我可以更改我的颜色?

这是我的代码:

trace2 =go.Bar(
x=['China','Hong Kong SAR','India','Indonesia','Japan','Malaysia','Phillpines','South Korea','Taiwan','Thailand','Vietnam'],
y=[4622347,1368789,2321576,5284928,2051699,2858926,1598839,114774,812080,1229608,1034688])

data = [trace2]
layout= dict(title='Total arrival counts from 2013 to 2015 for countries in Asia region by air', yaxis =dict(title='Arrival counts'),xaxis =dict(title='Countries'))
flg= go.Figure(data=data, layout=layout)
iplot(flg)
4

1 回答 1

0

您可以将颜色作为 RGBA 传递给Bar调用:

go.Bar(x, y, color=(0.2, 0.4, 0.6, 0.6))

对于 Plotly,您必须使用:

go.Bar(x, y, marker=dict(
        color='rgb(204,204,204)'))
于 2019-07-15T06:44:52.370 回答