# NOT RUN {
if(interactive()) {
p <- l_hist(mtcars$hp, linkingGroup = "mtcars")
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
linking(linkingGroup = "mtcars", sync = "push")
# set active layer
l_ggplot(mtcars, aes(mpg, wt, shape = factor(cyl))) +
geom_point(colour = "black", size = 4.5) +
geom_point(colour = "pink", size = 4) +
geom_point(aes(shape = factor(cyl))) +
# only the second layer is interactive
linking(activeGeomLayers = 2)
}
# }
Run the code above in your browser using DataLab