[R] Plots in ioslides and R markdown

Patrick Connolly p_connolly @ending from @ling@hot@co@nz
Fri Aug 24 12:13:17 CEST 2018


On Thu, 23-Aug-2018 at 07:23AM -0700, Jeff Newmiller wrote:

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

I took it as read that the plotting functions themselves aren't an
issue since they operate as intended outside of the Rmarkdown
space. Any function that uses the function plot() successfully will
do.  I was trying to ascertain how I should be setting up the scaling.

|> 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.

The objects loaded from .RData took hours of simulating and it's out
of the question to run them again inside Rmarkdown.  Though the script
used in the creation of .RData is reproducable, perhaps it would be
clearer for me to have saved the objects to a file by a different
name.

Is there a better way to do that??



|> 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.

-- 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
   ___    Patrick Connolly   
 {~._.~}                   Great minds discuss ideas    
 _( Y )_  	         Average minds discuss events 
(:_~*~_:)                  Small minds discuss people  
 (_)-(_)  	                      ..... Eleanor Roosevelt
	  
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.



More information about the R-help mailing list