Reputation: 101
I would like to change reverse the colors of the following plotly radar chart, as well as removing the -0.2 in the axis labels This plot was produced by the following code:
fig <- plot_ly(
type = 'scatterpolar',
fill = 'toself'
)
fig <- fig %>%
add_trace(
r = as.numeric(threats.mod["Country avg.", ]),
theta = threat.labs,
name = 'Country Avg.'
) %>%
add_trace(
r = as.numeric(threats.mod["Selection", ]),
theta = threat.labs,
name = 'Selection'
) %>%
layout(
polar = list(
radialaxis = list(
visible = T,
range = c(-0.2,1)
)
)
)
fig
Upvotes: 1
Views: 1378
Reputation: 101
Here's how I fixed it:
fig <- plot_ly(
type = 'scatterpolar',
fill = 'toself',
marker = list(colorscale="Greys")
)
fig <- fig %>%
add_trace(
r = as.numeric(threats.mod["Country avg.", ]),
theta = threat.labs,
name = 'Country Avg.',
fillcolor=rgb(153, 213, 148, 150, maxColorValue = 255),
marker=list(color=rgb(153, 213, 148, maxColorValue = 255))
) %>%
add_trace(
r = as.numeric(threats.mod["Selection", ]),
theta = threat.labs,
name = 'Selection',
fillcolor=rgb(252, 141,89, 150, maxColorValue = 255),
marker=list(color=rgb(252, 141, 89, maxColorValue = 255))
) %>%
layout(
polar = list(
radialaxis = list(
visible = T,
range = c(-20,100),
tickmode = "array",
tickvals = c(0, 50, 100),
ticktext = c("0%", "50%", "100%"),
angle= 0,
tickangle = 0
)
)
)
Upvotes: 1