0

I'm using the effects package in R to plot the effect on response variable of specific predictors in multiple linear regression. I'm trying to plot several of such plots in a single image.

When I plot several of them, the main text and axis text font size is too large, making it impossible to fit all the text (instead I have to use cryptic numbers and abbreviations, which isn't very helpful).

I want to make the main, axis and axis label text smaller.

Now, since the effectspackage uses lattice to generate plots, I'm using the lattice way of modifying font size i.e. trellis.par.set(). The weird thing is that it modifies single plots as specified, but when it pulls them together with the last command grid.arrange(), the values revert back to default.

I'm quite puzzled by this and have not been able to find a solution to this online. Any advice? Thanks in advance!

Here <code>trellis.par.set</code> doesn't work. Here `trellis.par.set() works.'

require(gridExtra)
require(lattice)
require(effects)

trellis.par.get()
trellis.par.set(list(par.xlab.text = list(cex=0.5),
                     par.ylab.text = list(cex=0.5),
                     par.main.text = list(col = "blue", cex=0.5)))

logit.plot = plot(Effect(c("LogitABCD.log.std"), logit.item.slope.mod), xlab = "Log Cond. Prob." , ylab = "Log RT", main="A.1 Pos. CP", ylim = c(6.0, 7.5))

logit.neg.plot = plot(Effect(c("LogitABCD.neg.log.std"), logit.neg.item.slope.mod), xlab = "Neg. Log Cond. Prob." , ylab = "Log RT", main="A.2 Neg. CP", ylim = c(6.0, 7.5))

MI.plot = plot(Effect(c("MIABCD.log.std"), MI.item.slope.mod), xlab = "Log MI" , ylab = "Log RT", main="   B.1 Pos. MI", ylim = c(6.0, 7.5))

MI.neg.plot = plot(Effect(c("MIABCD.neg.log.std"), MI.neg.item.slope.mod), xlab = "Neg. Log MI" , ylab = "Log RT", main="   B.2 Neg. MI", ylim = c(6.0, 7.5))

grid.arrange(logit.plot, MI.plot, logit.neg.plot, MI.neg.plot, ncol = 2)

I also tried to solve the issue by adapting a solution used in a related post, but that didn't work either. What I did was to preface the individual plot-making code with the following:

newSet = col.whitebg() 
newSet$superpose.symbol$cex = 0.5
newSet$superpose.symbol$col = "blue"

And then after the I call grid.arrange(), I inserted the following code:

pl = list(logit.plot, MI.plot, logit.neg.plot, MI.neg.plot)
do.call(grid.arrange, c(lapply(pl, update, par.settings=newSet), list(nrow=2)))

Still, no luck. Any advice?

zx8754
  • 52,746
  • 12
  • 114
  • 209
Des Grieux
  • 520
  • 1
  • 5
  • 31
  • 1
    Possible duplicate of [Multiple lattice plots with gridExtra](https://stackoverflow.com/questions/18419756/multiple-lattice-plots-with-gridextra) – Adam Quek Jun 13 '17 at 03:50
  • Thank you for pointing me to this resource. I edited the question to show that the post you suggested did not solve my problem. – Des Grieux Jun 13 '17 at 04:43

0 Answers0