In the code below I am looking to show text on a slide then below that show a plot. I am trying to do that in a one-column format on the "Slide with Plot" and in a two-column format on the "Two Column Slide". Can you advise how that is possible?
Below the text appears but the plots do not appear using plot() or print(plot()).
Thank you
---
params:
set_title: "My Title"
title: "Test"
subtitle: "Test"
output:
powerpoint_presentation:
reference_doc: template.pptx
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE , comment = NA, message= FALSE, warning = TRUE)
```
2## R Markdown
This is an R Markdown presentation. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document.
## Slide with Bullets
- Bullet 1
- Bullet 2
- Bullet 3
## Slide with R Output
```{r cars, echo = TRUE}
summary(cars)
```
## Slide with Plot
some text
```{r pressure, echo= FALSE, comment = FALSE, message= FALSE, warning = FALSE, results='asis'}
cat("\n\n more text")
plot(pressure)
cat("\n\n")
```
## Two Column Slide
:::::::::::::: {.columns}
::: {.column}
1st column test
```{r pressure2, echo= FALSE, comment = FALSE, message= FALSE, warning = FALSE, results='asis'}
cat("\n\n More 1st column text \n\n")
plot(pressure)
cat("\n\n")
```
:::
::: {.column}
2nd column text
```{r pressure80}
print(plot(pressure))
```
:::
::::::::::::::
You can't really use results = 'asis' with plot inside the chunk. The plot won't be process as it should by knitr.
Results asis is for including a cat() output asis in the markdown document. Plot won't return something you can include like this.
I think you need a recent version of Pandoc for this to work. You may need to use RStudio IDE daily version or install a recent pandoc yourself.
Thank you. I have pandoc version 2.7.2 and rmarkdown 2.1 and running your code above does not show the plots. Do you know versions are necessary for the comparison layout?
I have 2.7.2 so I think it should work but no luck. I am using reference_doc: template.pptx and I added a layout slide in that pptx file called "Comparison" with the comparison layout but I still do not see the plot. Also, to tesst, I removed the reference_doc: template.pptx and no plots appeared.