自定义颜色在Choropleth贴图中不起作用

时间:2020-09-12 19:59:52

标签: r-plotly

我正在尝试在我的Choropleth贴图上更改颜色主题,但是无论我使用colors = 指定什么,我都无法将贴图更改为默认值以外的其他颜色。有什么想法吗?

g <- list(
  scope = 'usa',
  projection = list(type = 'albers usa'),
  showlakes = FALSE,
  lakecolor = toRGB('white')
)

fig <- plot_geo(purple_states, locationmode = 'USA-states')
fig <- fig %>% add_trace(
    z = ~swing, locations = ~abb,
    color = ~purple_states, colors = 'Purples', frame = ~year,
    zmin = -0.5, zmax = 0.5
  )
fig <- fig %>% colorbar(title = 'Swing')
fig <- fig %>% layout(
    title = 'US Presidential Election Electoral College Results 1948-2016',
    geo = g
  )

fig

Image of fig

0 个答案:

没有答案