ggvis in R: Change color when mouse hover

51 views Asked by At

Is there a code that can realize the first example picture on the GGVIS homepage?

https://ggvis.rstudio.com/

enter image description here

The function I want is that the color changes when I hover over the bar.

Thanks.

1

There are 1 answers

0
tamtam On BEST ANSWER

Try the fill.hover argument:

library(ggvis)

faithful %>% 
ggvis(~eruptions, fill := "#fff8dc", fill.hover := "#fcb5a2") %>%
  layer_histograms(width = 0.25)