[R] plots for presentation

Yihui Xie xie at yihui.name
Sun Oct 21 01:43:36 CEST 2012


Here is a knitr example that shows you how to automate this job (with
the PDF attached):
https://github.com/yihui/knitr-examples/blob/master/053-beamer-only.Rnw

The key is the chunk options fig.show='hold' and fig.keep='all'; knitr
will find \includegraphics in the chunk and replace them with
\only<n>{\includegraphics} where n is the number of the plot. And
fig.keep='all' makes it easier than Sweave, because you can just draw
the plots and all low-level plot changes will be recorded.

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Fri, Oct 12, 2012 at 3:20 PM, Greg Snow <538280 at gmail.com> wrote:
> Duncan's answer is probably the easiest, but another alternative is to
> use the tikz device instead of .eps files, then you can find the code
> within the figure for the parts that you want to appear later and
> enclose them in the beamer commands that will make them appear later.
> Unfortunately this is not easy to automate, if you recreate the plot,
> then you need to completely redo the inserting of the beamer commands.
>
>
>
> On Thu, Oct 11, 2012 at 11:56 AM, Duncan Murdoch
> <murdoch.duncan at gmail.com> wrote:
>> On 11/10/2012 1:08 PM, mamush bukana wrote:
>>>
>>> Dear users,
>>> I am preparing a presentation in latex(beamer) . I would like to show
>>> parts
>>> of my plots per click. Example, consider I have two time series x and y:
>>>
>>> x<-ts(rnorm(100), start=1900,end=1999)
>>> y<-ts(rnorm(100), start=1900,end=1999)
>>> plot(x)
>>> lines(y,col=2)
>>>
>>> Then I imported this plot into latex as ".eps" file. My question is, how
>>> can i show plot of each time series separately in sequence (one after the
>>> other). An also I want to show parts of the plots at different time
>>> segments in my presentation. To be honest, I don't know if these features
>>> are in R or in latex.
>>
>>
>> Mostly Latex/Beamer.  Draw the two versions of the plot, and tell beamer to
>> show the first one only on overlay 1, the second only on overlay 2.
>>
>> This is particularly easy using Sweave, because you can save the code that
>> drew the first plot and re-use it in the second.
>>
>> Duncan Murdoch
>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 053-beamer-only.pdf
Type: application/pdf
Size: 73460 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20121020/86b65c80/attachment-0002.pdf>


More information about the R-help mailing list