Пока что я могу решать решено помеченных предметов.
R, сюжетный код:
library(plotly)
df <- data.frame(
r = c(0,1,2,2,1.5,3, 1, 2, 3, 4, 5, 6),
theta = c(0,45,90,315, 180, 270, 10, 40, 70, 100, 130, 160),
group = c('R', 'B', 'G', 'R', 'G', 'B', 'R', 'B', 'G', 'R', 'G', 'B'),
size = c(1, 2, 3, 10, 20, 9, 2, 4, 6, 8, 10, 12)
)
colors_map <- c("blue", "green", "red")
p <- plot_ly(
df,
type = 'scatterpolar',
r = ~r,
theta = ~theta,
color = ~group,
colors = colors_map, #Provide a color mapped vector
size = ~size,
sizes = c(100,200), #Provide a range of size.
text = ~paste('<b>DETAILS </b><br>---------------<br>Radius:', r, '<br>Theta:', theta, '<br>Group:', group, '<br>Size:', size),
mode = 'markers',
hoverinfo="text",
marker = list(symbol = 'circle', line = list(width = 2, color = 'lightgrey'))
)%>%
layout(title = 'SAMPLE TITLE',
showlegend = TRUE,
polar = list(
#hole = 0.5,
radialaxis = list(
tickfont = list(
size = 20,
color = "blue"
),
visible = TRUE,
tickcolor = toRGB("red"),
ticks = "outside",
#ticklen = 15,
#tickwidth = 20,
range = c(0, max(df$r)),
rangemode = "tozero",
angle = 90,
tickangle = 90,
tickmode="array",
tickvals = c(0, 1, 2, 3, 4, 5, 6, 7),
ticktext = c('', "One", "Two", "Three", "Four", "Five", "Six", "Seven")
#gridcolor = '#FFF', #color of grid lines
#categoryorder = "array",
#categoryarray = c("GroupA", "GroupB", "GroupC", "GroupD") #Not working
),
angularaxis = list(
tickfont = list(
size = 12
),
rotation = 90,
direction = 'clockwise' ,
categoryarray = c("A", "B", "C", "D") #Not working
)
)
)%>%
add_trace(
r = ~r,
theta = ~theta,
mode = "text",
text = ~size,
textfont = list(color = '#000000', size = 12)
) %>%
add_trace(
r = ~r,
theta = ~theta,
mode = "marker",
opacity = 0.5,
text = ~paste('<b>DETAILS </b><br>---------------<br>Radius:', r, '<br>Theta:', theta, '<br>Group:', group, '<br>Size:', size),
hoverinfo = "text"
)
ggplotly(p)
Диаграмма: