Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Radar plot - legend problem

Hey everyone,

I’m having a new problem in the legend of the radar plot after changing the colors of each group.

The legend shows the name of each group (which is correct) but it also shows the color name (the rgb code).

It looks like this:

Is it possible to only show the group names?

I’ll leave a reproducible example:

attrib1 <- c( 2, 3, 5)
attrib2 <- c( 1, 2, 5)
attrib3 <- c( 5, 2, 4)
attrib4 <- c( 4, 3, 1)
attrib5 <- c( 2, 2, 1)


teams_final <- data.frame(attrib1, attrib2, attrib3, attrib4, attrib5, attrib1)

row.names(teams_final) <- c("A Team", "B Team", "C Team")

labels <- c("attrib1", "attrib2", "attrib3", "attrib4", "attrib5", "attrib1")


library(plotly)

p <- plot_ly(
    type = 'scatterpolar', fill = 'toself') %>%
    
    add_trace(r = unname(teams_final[1, ]), theta = labels, name = "A Team", 
              fillcolor = 'rgba(64, 64, 64, 0.5)', marker = list(color = '#404040'),
              hoverinfo = "text", 
              text = ~paste(labels, '<br> Importância: ', unname(teams_final[1, ]))) %>%
    
    add_trace(r = unname(teams_final[2, ]), theta = labels, name = "B Team",
              fillcolor = 'rgba(171, 35, 35, 0.5)', marker = list(color = '#AB2323'), 
              hoverinfo = "text", 
              text = ~paste(labels, '<br> Importância: ', unname(teams_final[1, ]))) %>%
    
    add_trace(r = unname(teams_final[3, ]), theta = labels, name = "C Team",
              fillcolor = 'rgba(241, 103, 69, 0.5)', marker = list(color = '#F16745'), 
              hoverinfo = "text", 
              text = ~paste(labels, '<br> Importância: ', unname(teams_final[1, ]))) %>%
    
    layout(polar = list(radialaxis = list(visible = T, range = c(0,6))), 
         font = list(size = 11, color = "#202020"))

p

Cheers,

Bruno

Any suggestion? :slight_smile: