Search code examples
rplotpresentationr-markdown

How can I incrementally build a plot in an ioslide presentation using Rmarkdown?


I'm trying to build a plot incrementally on one slide using Rmarkdown to create an ioslides (HTML) presentation. I've tried using {.build} but to no avail, and it seems there is no documentation on this in the Rmarkdown community. Does anyone know how to write this code in R?

Here is a MWE where I try to build a plot in three steps, from a blank plot to a scatterplot to a lineplot, all in one slide where the plots unfold by clicking forward one at a time:

---
title: "Untitled"
author: "User"
date: "07/03/2014"
output: ioslides_presentation
---

## Slide Title

```{r, echo=FALSE}
x <- rnorm(10)
```

```{r, echo=FALSE, fig.align='center'}
plot(1:10,x,type='n')
```

```{r, echo=FALSE, fig.align='center'}
plot(1:10,x,type='p')
```

```{r, echo=FALSE, fig.align='center'}
plot(1:10,x,type='b')
```

Any thoughts on how to get this?


Solution

  • After the slide title

    <div class="incremental">  
    

    And then at the end

    </div>