if(interactive()) {
# highlight the four gear cars
fourGear <- rep(FALSE, nrow(mtcars))
fourGear[mtcars$gear == 4] <- TRUE
l_ggplot(mtcars, mapping = aes(x = wt, y = hp, color = factor(cyl))) +
geom_point(size = 4) +
# push the states of scatter plot to the histogram
selection(selected = fourGear)
}
Run the code above in your browser using DataLab