0

I try to change the appearance of plots created by the BEST package for R by changing the displayed font. However, I can only alter the labels with the command family =. The difference can be seen in the images below.

If I use font.axis or font.lab from par there will be no compilation with the following error message:

Quitting from lines 42-44 (BEST_Package_font.Rmd) 
Error in plot.window(xlim, ylim, "", ...) : 
  invalid value specified for graphical parameter "font.lab"
Calls: <Anonymous> ... do.call -> <Anonymous> -> plot.histogram -> plot.window

Execution halted
library(BEST)

quartzFonts(ubuntu = c("Ubuntu-R", "Ubuntu-I", "Ubuntu-L", "Ubuntu-BI"))

y1 <- c(5.77, 5.33, 4.59, 4.33, 3.66, 4.48)
y2 <- c(3.88, 3.55, 3.29, 2.59, 2.33, 3.59)

BESTout <- BESTmcmc(y1, y2, priors=NULL, parallel=FALSE)

plot(BESTout, which = "mean")

plot(BESTout, which = "mean", family = "Ubuntu-I") 

I used the family font Ubuntu as an example, but this behavior also happens with other fonts. Is there any possibility to change the font of every number and character in the plot?

Thank you.

enter image description here

enter image description here

17757970
  • 141
  • 6

1 Answers1

0

Thanks to this answer a clean solution has been found, which can also be applied to the BEST package. Defining fonts like shown above is not necessary.

library(BEST)


y1 <- c(5.77, 5.33, 4.59, 4.33, 3.66, 4.48)
y2 <- c(3.88, 3.55, 3.29, 2.59, 2.33, 3.59)

BESTout <- BESTmcmc(y1, y2, priors=NULL, parallel=FALSE)

par(family = "Ubuntu-R")

plot(BESTout, which = "mean")

enter image description here

17757970
  • 141
  • 6