I'm trying to make a simple scatterpolar chart in R Plotly that has 60+ categorical labels on the radial axis. Because there's so many labels, the default method of placing the labels results in them overlapping each other at the top and bottom of the chart. I've tried setting layout.polar.angularaxis.tickangle to 90, -90, etc, but that rotates ALL labels by that amount. Is there a way to either A) rotate each individual label by a specified value such that I can set some labels to -90 degrees, others to -45, others to 0, others to +45, etc... or B) leave the label rotations at 0 (as they are now), but dodge them a bit so they don't overlap at the top and bottom of the chart? I think B would be easier and preferred, but not sure if either A or B are possible.
Here's a minimum reproducible example:
labs1 <- c("Red ", "Green ", "Blue ", "Yellow ", "Orange ",
"Purple ", "Pink ", "Black ", "White ", "Gray ")
labs2 <- c("Bookshelf", "Television", "Refridgerator",
"Toolbox", "Xylophone" , "Chromosome")
labs <- sample(paste0(rep(labs1, each = 6), rep(labs2, times = 10)), 60, replace = F)
df <- data.frame(Label = labs,
Radius = sample(0:100, 60, replace = F))
plot_ly(df) %>%
add_trace(type = 'scatterpolar', mode = 'markers',
r = ~Radius,
theta = ~Label,
fill = 'toself')
And here's the result:
