Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
128 views
in Technique[技术] by (71.8m points)

r - Font size in mirt plots

I'm trying to increase font size in mirt plots, however, so far I'm able to increase size of ticks only:

library(mirt)
x <- mirt(Science, 1, SE=TRUE)
plot(x)

plot(x, scales = list(cex = c(1.4)))

How can I increase size of the axis and main title? I tried to add xlab = list(cex = 1.4), however I'm getting an error:

Error in xyplot.formula(score ~ Theta, plt, ylim = c(sum(mins) - ybump_full,  : 
  formal argument "xlab" matched by multiple actual arguments

**EDIT: ** Some parts can be increased with trellis.par.set() as suggested by @user20650, however it does not include font size of legend.

trellis.par.set(par.xlab.text = list(cex = 1.4), par.ylab.text = list(cex = 1.4))
plot(x, type = "trace", facet_items = FALSE, scales = list(cex = 1.4), 
     par.strip.text = list(cex = 1.4), main = FALSE)

Moreover, this does not have impact on the following plot:

plot(x, type = "infoSE", facet_items = FALSE, scales = list(cex = 1.4), 
     par.strip.text = list(cex = 1.4), main = FALSE)

question from:https://stackoverflow.com/questions/65952656/font-size-in-mirt-plots

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can set parameters globally with trellis.par.set or pass to the individual plot using the par.settings parameter. trellis.par.get() can be used to get a list of the names of the objects that can be updated.

So for example the following can be used to update specific parameters within a plot

plot(x, type = "trace", 
     par.settings=list(
       par.xlab.text=list(cex=3, col="red"),
       par.main.text=list(cex=2)))

Or to update globally use

trellis.par.set(par.xlab.text=list(cex=3, col="red"),
                par.main.text=list(cex=2)
                )

Using grid.pars=list(cex=3)) seems to update all text sizes


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...