[R] Plots in ioslides and R markdown

Patrick Connolly
Sat, 25 Aug 2018 23:37:02 -0000

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

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