I use ggplot2 to plot my graphs. I want to use the graphs to create a keynote presentation.
During my presentation, I want to introduce different elements of the plot sequentially. First, the points corresponding to the condition A, then the points corresponding to condition B and then some curves for example.
I thought that maybe I could create the whole plot and export it in a way that I could manipulate single elements in keynote (like deleting the points of one condition). Thanks to people from stackoverflow, I was able to do that: R, export a file to keynote
But I found that it is very difficult to select individual elements in keynote. So, I wonder which is there is some more efficient way.
If you're willing to use some different tools, this is very doable with Sweave
and the LaTeX
document class beamer
for the slides:
\documentclass{beamer}
\title{Sequential Graphs}
\begin{document}
\frame{\titlepage}
\frame{
Here's a graph:
<<echo = FALSE,fig = TRUE>>=
library(ggplot2)
d1 <- data.frame(x = 1:20, y = runif(20),grp = rep(letters[1:2],each = 10))
p <- ggplot(data = d1, aes(x = x, y = y)) + geom_point()
print(p)
@
}
\frame{
Here's the next graph:
<<echo = FALSE,fig = TRUE>>=
p <- p +geom_line(aes(group = 1))
print(p)
@
}
\frame{
Here's the last graph:
<<echo = FALSE,fig = TRUE>>=
p <- p +geom_point(aes(colour = grp))
print(p)
@
}
\end{document}
I've used ggplot
here since it has a convenient syntax for adding elements to a graph, but this should work with any other graphics method in R, I'd think.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With