if(interactive() && requireNamespace("dplyr")) {
h <- l_hist(mtcars$hp,
linkingKey = rownames(mtcars),
linkingGroup = "mtcars")
mtcars %>%
mutate(carName = rownames(mtcars)) %>%
l_ggplot(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",
linkingKey = ~carName,
sync = "push")
}
Run the code above in your browser using DataLab