[R] Plots in ioslides and R markdown

Patrick Connolly p_connolly @ending from @ling@hot@co@nz
Thu Aug 23 11:15:19 CEST 2018


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.

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