[R] Plots in ioslides and R markdown

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Thu Aug 23 16:23:32 CEST 2018


This is not reproducible because you have not provided the plot code or sample data. Output of sessionInfo would probably be appropriate as well.

As to whether needing to load objects is typical... yes, rmarkdown runs from a fresh environment to emphasize reproducibility, but your load command is bypassing that for us.

On August 23, 2018 2:15:19 AM PDT, Patrick Connolly <p_connolly using slingshot.co.nz> wrote:
>I'm having difficulty getting plots into ioslides.  It seems to me
>that the scale is completely out, but I can't figure out what to do
>about it.  Whatever I try, I get the title slide, then a second with a
>horizontal line and a vertical line in the bottom right corner.  It
>looks like a badly scaled plot about 25 times the size of the plotting
>area, so only a fragment is visible.
>
>This is the code I've tried:
>
>---
>title: "Barking up the wrong tree"
>author: "Patrick Connolly"
>date: "`r format(Sys.time(), '%a %d/%m/%Y %H:%M')`"
>output: ioslides_presentation
>---
>
>```{r global_options, echo=FALSE}
>knitr::opts_chunk$set(tidy=TRUE,
>                      warning=FALSE, 
>                      message=FALSE,
>                      cache=FALSE,
>                      dpi=600)
>```
>
>```{r use these functions, echo= FALSE}
>  load(".RData") ## code for 6 plotting functions
>
>``
>## 6 different Trees
>
>```{r 6 different Trees, echo = FALSE, messages=FALSE, fig.width = 7,
>fig.height = 5}
>
>###  par(mfrow = c(2, 3))
>plot1()
>plot2()
>plot3()
>plot4()
>plot5()
>plot6()
>}
>```
>
>If I run the plot functions in the Console, it all works and displays
>correctly in Rstudiio's plot panel, even the mfrow bit.  But I haven't
>worked out how to include the code into Rmarkdown.  I thought it might
>be less taxing to not try putting the 6 plots on the same slide, but
>it makes no difference when I commented out the mfrow bit.
>
>I'm not very familiar with the workings of Markdown or Rstudio, but it
>does seem strange to me that I need to specifically load the global
>environment otherwise it's not visible.  Is that to be expected?
>
>Ideas welcome, particularly about scaling.

-- 
Sent from my phone. Please excuse my brevity.




More information about the R-help mailing list