It should be quite simple to adjust the font size in plotting the outcome ofautofitVariogram
using the automap package. The text fonts for the number of pairs are too big; the text fonts for the model, nugget… information are too small and not presentable. I was able to adjust the size of the points, but I failed to adjust the font of the label (or remove them) and the model information.
I've tried:
library(automap)
data(meuse)
coordinates(meuse) <- c("x","y")
data.auto.variogram <- autofitVariogram(formula = zinc ~1, input_data = meuse)
plot(data.auto.variogram, cex=1, par.settings=list(fontsize=list(text=5),par.main.text=list(cex=3), par.xlab.text=list(cex=2),par.ylab.text=list(cex=2)))
But that also reduces the size of the axis label and the information text.
We can use meuse
as a reproducible example.
Can anyone give some solutions or recommendations please?
Best Answer
The text size of bottom-right annotations is hard-coded in autokrige.vgm.panel.r, which runs under the hood of automap's
plot()
method. The latter function is also responsible for creating point labels that are passed togstat::vgm.panel.xyplot()
, which is hard-coded as well. Now, you might get rid of these point labels through something likeor, similarly,
opts$add.text$cex
to reduce text size. However, this won't affect the bottom-right text section. In order to overcome this limitation, why not just define your own plotting function for objects of class 'autofitVariogram'? Taking inspiration from the source code of autokrige.vgm.panel.r, this requires little coding efforts and, at the same time, lets you modify the visual appearance of the resulting scatter plot at will.