Joe
Joe

Reputation: 3806

is there a way to hide slide elements after displaying them in xaringan?

I can use the -- operator to perform gradual reveals of slide content with xaringan, but is there a way to hide elements after they have been displayed?

For instance, in the example below I show a title and two plots with a gradual reveal between each. I also have a make-believe operator -hide- that would ideally hide the first plot before revealing the second to avoid overcrowding my plot.

I can make a duplicate slide as a short-term fix, but hiding elements is a common practice in slide animations and I wanted to see if xaringagn supported it.

---
# slide title

--

```{r}
<my_cool_plot>
```

-hide-

--

```{r}
<next_iteration_of_my_cool_plot>
```

Upvotes: 0

Views: 150

Answers (1)

manro
manro

Reputation: 3677

I think, "the simpler - the better" :)

---
## slide XX

<details open> #is opened by default
<summary>Plot of the function A(x+y)</summary>
```{r pressure, echo=FALSE}
plot(pressure)
```
</details>

<details>
<summary>Plot of the function A(x+y+z)</summary>
```{r pressure1, echo=FALSE}
plot(pressure)
```
</details>

If you want - you can tune dimensions of your plots with fig.width, fig.height that both of your graphs could be displayed simultaneously.

enter image description here

Upvotes: 1

Related Questions