0

Suppose I have the following graph

library(ggvis)
mtcars%>% ggvis(~factor(cyl)) %>% layer_bars()

How can I add a tooltip with the count variable?

Thanks

Ignacio
  • 7,646
  • 16
  • 60
  • 113

1 Answers1

1

This does the trick:

library(ggvis)
mtcars  %>% ggvis(~factor(cyl)) %>% layer_bars() %>%
  add_tooltip(function(df) (df$stack_upr_ - df$stack_lwr_))
Ignacio
  • 7,646
  • 16
  • 60
  • 113