[R] Plots in ioslides and R markdown

Patrick Connolly
Sat, 25 Aug 2018 10:21:46 -0000

I've simplified it so that it's reproducible:


---
title: "Barking up the wrong tree"
author: "Patrick Connolly"
date: "`r format(Sys.time(), '%a %d/%m/%Y %H:%M')`"
output:
  ioslides_presentation: default
  slidy_presentation: default
  beamer_presentation: default
---

```{r global_options, echo=FALSE}
knitr::opts_chunk$set(tidy=TRUE,
                      warning=FALSE,
                      message=FALSE,
                      cache=FALSE,
                      dpi = 300)

```
## 6 different Regression Trees

```{r 6 different Regression Trees, echo = FALSE, messages=FALSE, fig.width = 7,
fig.height = 5}

 par(mfrow = c(2, 3))
plot(1:10)
plot(12:4)
plot(seq(0, 800))
plot(-100:-900)
plot(12:50)
plot(90:54)
```

I've tried it on a different machine which gives a slightly more
informative message:

X11 font -adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*, face 1 at size 12 could
not be loaded

That seems to be associated with the Cairo plotting device which isn't
necessary with pdf devices which I normally use, nor, it would seem by
the plot pane in Rstudio.  Consequently, running the plot code itself
works fine, but if is to be incorporated in HTML, we run into the Cairo
issue, Looking into that one, it appears something has been orphaned
for a couple of years.  If anyone has information about that, I'd be
interested.

TIA


-------------

 version 3.5.0 (2018-04-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS

Matrix products: default
BLAS: /home/pat/local/R-3.5.0/lib/libRblas.so
LAPACK: /home/pat/local/R-3.5.0/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_NZ.UTF-8       LC_NUMERIC=C               LC_TIME=en_NZ.UTF-8
 [4] LC_COLLATE=en_NZ.UTF-8     LC_MONETARY=en_NZ.UTF-8
LC_MESSAGES=en_NZ.UTF-8
 [7] LC_PAPER=en_NZ.UTF-8       LC_NAME=C                  LC_ADDRESS=C
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_NZ.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] utils     stats     grDevices graphics  methods   base

other attached packages:
[1] sp_1.3-1        lattice_0.20-35

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.17     knitr_1.20       bindr_0.1.1      magrittr_1.5
tidyselect_0.2.4 munsell_0.5.0
 [7] colorspace_1.3-2 xtable_1.8-2     R6_2.2.2         rlang_0.2.1
stringr_1.3.1    plyr_1.8.4
[13] dplyr_0.7.6      tools_3.5.0      grid_3.5.0       htmltools_0.3.6
crosstalk_1.0.0  rprojroot_1.3-2
[19] yaml_2.1.19      leaflet_2.0.1    assertthat_0.2.0 digest_0.6.15
tibble_1.4.2     bindrcpp_0.2.2
[25] shiny_1.1.0      purrr_0.2.5      later_0.7.3      htmlwidgets_1.2
promises_1.0.1   evaluate_0.10.1
[31] glue_1.2.0       mime_0.5         rmarkdown_1.10   stringi_1.2.3
compiler_3.5.0   pillar_1.2.3
[37] backports_1.1.2  scales_0.5.0     httpuv_1.4.4.2   pkgconfig_2.0.1

>



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.
|>
|> 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 at
slingshot.co.nz> wrote:
|> >I'm having difficulty getting plots into ioslides.

[...]


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

~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.