--- title: "My Rmd Document" output: html_document: self_contained: false --- ```{r safety, echo = FALSE} library(knitr) # Calling knit_meta() here is just a safety protocol. # knit_print.animint uses knitr's meta-data to efficiently place JS scripts. # If this meta-data isn't clear when a document is knit, the result won't be rendered properly knit_meta() ``` ```{r plot-1-top} library(ggplot2) library(animint) dat <- data.frame(x = 1:10, y = 1:10, label = rep(c("a178", "b934"), 5)) q2 <- list(q = qplot(x, y, data = dat, colour = label, xlab = "first plot with color legend")) structure(q2, class = "animint") ``` Clicking on the plot above should not affect the plot below. ```{r plot.1.bottom} q1 <- list(q = qplot(x, y, data = dat, colour = label, xlab = "second plot with color legend")) structure(q1, class = "animint") ``` The plot below has no interactive features. ```{r boring} boring <- list(q = qplot(rnorm(100), xlab = "non-interactive plot")) structure(boring, class = "animint") ``` The next data viz consists of two plots, one of which should have common chunk data files. ```{r breakpoints} data(breakpoints) only.error <- subset(breakpoints$error,type=="E") only.segments <- subset(only.error,bases.per.probe==bases.per.probe[1]) signal.colors <- c(estimate="#0adb0a", latent="#0098ef") breakpointError <- list(signal=ggplot()+ geom_point(aes(position, signal, showSelected=bases.per.probe), data=breakpoints$signals)+ geom_line(aes(position, signal), colour=signal.colors[["latent"]], data=breakpoints$imprecision)+ geom_segment(aes(first.base, mean, xend=last.base, yend=mean, showSelected=segments, showSelected2=bases.per.probe), colour=signal.colors[["estimate"]], data=breakpoints$segments)+ geom_vline(aes(xintercept=base, showSelected=segments, showSelected2=bases.per.probe), colour=signal.colors[["estimate"]], linetype="dashed", data=breakpoints$breaks), error=ggplot()+ geom_vline(aes(xintercept=segments, clickSelects=segments), data=only.segments, lwd=17, alpha=1/2)+ geom_line(aes(segments, error, group=bases.per.probe, clickSelects=bases.per.probe), data=only.error, lwd=4), first=list(segments=6)) structure(breakpointError, class="animint") ```