I am trying to build a map in R using plotly. I will share the code required to build the dataframe in a reply to this post. Here is the code I am using to plot the chart:
florida %>%
group_by(group) %>%
plot_ly(x = ~long, y = ~lat,
color = ~color_vals, colors = 'Blues') %>%
add_polygons(line = list(width = 2),
# fillcolor = 'WHAT GOES HERE',
opacity = 1, showlegend = FALSE)
and here is the output I am getting:
My issue is simple to understand, but I cannot find a way to fix this. I'd like the fillcolor for each of the different counties to be the same shade of blue as the boundary lines for that county. In plotly's documentation, it states for fillcolor:
fillcolor (color)
Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available.
And herein lies the problem... I don't want a half-transparent variant of the line color, I want the actual line color! I've tried passing many different values to the fillcolor parameter, but have had no luck. Any help with this would be super appreciated!
Thanks!
EDIT - the dput on the florida dataframe is very very large, exceeding the RStudio console's print output max. Some similar, reproducible examples are here though - https://plot.ly/r/county-level-choropleth/.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…