简体   繁体   中英

Hover tooltip by group in ggvis

I want to be able to hover over a given point and be able to see information about that specific point and have it pop up larger than the others. That's done in the code below.

all_values <- function(x) {
  if(is.null(x)) return(NULL)
  paste0(names(x), ": ", format(x), collapse = "<br />")
}

iris %>% 
  ggvis(~Sepal.Length,~Petal.Length) %>%
    layer_points(size := 50, fill.hover := "yellow", size.hover := 200) %>% 
    add_tooltip(all_values, "hover")

Is there a way for all the points sharing the same Species variable as the selected point to have this highlighting applied to them as well? In my real data, the fill and shape variables are being used to convey other information, so I need a way to quickly highlight an entire group.

这并不能真正回答您的问题,但是您是否考虑过使用fill属性对数据进行可视化分组?

layer_points(size := 50, fill = ~Species)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM