[R] Plots in ioslides and R markdown

Patrick Connolly p_conno||y @end|ng |rom @||ng@hot@co@nz
Sun Aug 26 10:40:32 CEST 2018


On Sat, 25-Aug-2018 at 08:10PM -0400, Duncan Murdoch wrote:

|> On 25/08/2018 7:37 PM, Patrick Connolly wrote:
|> >On Sat, 25-Aug-2018 at 07:53AM -0400, Duncan Murdoch wrote:
|> >
|> >|> On 25/08/2018 6:21 AM, Patrick Connolly wrote:
|> >|> >---
|> >|> >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)
|> >|>
|> >|> Drop the dpi setting and it will work fine.
|> >
|> >Still doesn't avoid what I think is the issue with Cairo
|> >
|> >    Error in axis(side = side, at = at, labels = labels, ...) : X11
|> >   font -adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*, face 1 at size 12
|> >   could not be loaded Calls: <Anonymous> ... plot.default -> localAxis
|> >   -> Axis -> Axis.default -> axis
|> >
|> >   Execution halted
|> >
|> >
|> >For interactive plotting, Rstudio plots those 6 plots on one page so
|> >no issue is apparent, as it will if I use a pdf device within ESS.
|> 
|> So use RStudio, don't use ESS.

I'm using Rstudio to try to output ioslides which runs into the font
problem which doesn't arise when plotting to the plot pane.  RStudio's
no advantage when the objective is ioslides.  That observation gives
rise to my hypothesis that to produce ioslides, Cairo is utilized in
ways incomprehensible to me.

|> 
|> >However, when plotting interactively in ESS, a basic font is used for
|> >the labels which is OK for preliminary quick look.  No error message
|> >is shown, but I suspect that it is defaulting to a crude font because
|> >the helvetica font is not available.
|> >
|> >It appears to me that the font problem doesn't arise with Rstudio
|> >unless the desired output is ioslides.  Which brings us back to the
|> >issue with Cairo.  There are lots of hits when I search for
|> >configuring fonts, Cairo and R but I've not found anything I can use.
|> >
|> 
|> I don't see a font problem in MacOS.  I don't think you've stated
|> what system you are using (but I may have missed it).

It has something to do with X11 which I guess MacOS doesn't use.

> sessionInfo()
R 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              
 [3] LC_TIME=en_NZ.UTF-8        LC_COLLATE=en_NZ.UTF-8    
 [5] LC_MONETARY=en_NZ.UTF-8    LC_MESSAGES=en_NZ.UTF-8   
 [7] LC_PAPER=en_NZ.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_NZ.UTF-8 LC_IDENTIFICATION=C       

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

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

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.17     bindr_0.1.1      magrittr_1.5     tidyselect_0.2.4
 [5] munsell_0.5.0    colorspace_1.3-2 xtable_1.8-2     R6_2.2.2        
 [9] rlang_0.2.1      plyr_1.8.4       dplyr_0.7.6      tools_3.5.0     
[13] grid_3.5.0       htmltools_0.3.6  crosstalk_1.0.0  leaflet_2.0.1   
[17] assertthat_0.2.0 digest_0.6.15    tibble_1.4.2     bindrcpp_0.2.2  
[21] shiny_1.1.0      purrr_0.2.5      later_0.7.3      htmlwidgets_1.2 
[25] promises_1.0.1   glue_1.2.0       mime_0.5         compiler_3.5.0  
[29] pillar_1.2.3     scales_0.5.0     httpuv_1.4.4.2   pkgconfig_2.0.1 


|> 
|> Duncan Murdoch
|> 
|> >I would appreciate pointers where I can find useful information.
|> >
|> >Thank you.
|> >
|> >|>
|> >|> Duncan Murdoch
|> >|>
|> >|> >```
|> >|> >## 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)
|> >|> >```
|> >

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