leewan
leewan

Reputation: 113

ggvis in R: Change color when mouse hover

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.

Upvotes: 0

Views: 53

Answers (1)

tamtam
tamtam

Reputation: 3671

Try the fill.hover argument:

library(ggvis)

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

Upvotes: 1

Related Questions