Rpresentation in Rstudio - Make image fill out the whole screen

后端 未结 5 1315
星月不相逢
星月不相逢 2020-12-23 11:36

Making an Rpresentation in Rstudio with knitr I have a slide with just one picture, which I want to fill out the whole screen/slide. How do I do that?

The second sli

5条回答
  •  南方客
    南方客 (楼主)
    2020-12-23 12:19

    If you're using reveal.js in Rmarkdown, applying the {data-background="my_img.png"} argument to a new slide allows you to use a newly generated plot as the image background for that slide, which fills out the entire device area without needing to modify any device output specs.

    R plots are saved in the my_pres_files/figure-revealjs/ folder in your local dir. Attributing a name to the code chunk for the plot in your Rmd file will give the plot png file that name in this dir. E.g.

    ```{r, myplot} 
    # r code to generate plot
    # name the code chunk to attribute a name to the image file of the plot in your local dir
    ```
    

    This will give you the following path:

    "my_pres/my_pres_files/figure-revealjs/myplot-1.png"

    Then use this path in the `data-background = "my_img.png" argument.

    
    
    # {data-background="my_pres/my_pres_files/figure-revealjs/myplot-1.png"}
    
    

提交回复
热议问题