ricardo-bion / ggradar

radar charts with ggplot2
https://twitter.com/ricardobion
333 stars 97 forks source link

Display actual values instead of coordinates when using ggplotly in combination with ggradar #36

Open makis23 opened 4 years ago

makis23 commented 4 years ago

I use ggradar in combination with plotly to create a radar chart. After using plotly to obtain the hover-text ability I get the coordinates of every point when I mouse over each point but this does not make sense to me. How can I get the actual values instead of coordinates?

library(ggradar)
library(dplyr)
library(scales)
library(tibble)
library(plotly)
mtcars_radar <- mtcars %>% 
  as_tibble(rownames = "group") %>% 
  mutate_at(vars(-group), rescale) %>% 
  tail(4) %>% 
  select(1:10)

p<-ggradar(mtcars_radar)
ggplotly(p)
ccbvib commented 2 years ago

I am also experiencing this problem. The ggradar legend does not display class labels (i.e. row names of the input data) instead it displays the min/max point corresponding to each axis. I have tried to coerce the labels to appear in the legend without success.

EnzoNMigliano commented 2 years ago

Hi @ccbvib and @makis23!

I have something that might help you. A few years ago, I did a radar visualization with plotly and ran into the same issue. However, I did some edits to ggradar's source code so it would add a tooltip with customized values to the plotly.

I created a GitHub repository with this customization for you:

https://github.com/EnzoNMigliano/Modified_ggradar_to_Support_plotly_Tooltip

I hope it helps!

Cheers!

Enzo