[R] Space between axis title and tick labels in persp plot in R (using vis.gam)

j@de@shod@@ m@iii@g oii googiem@ii@com j@de@shod@@ m@iii@g oii googiem@ii@com
Wed Jul 6 19:22:09 CEST 2022


Dear list,

I am making a perspective plot of my generalised additive model (GAM)
named a1b, using vis.gam() in mgcv, which in turn makes use of the
persp function in base R.

Code is as follows:

library(mgcv)
vis.gam(x = a1b,
        view = c("wbgt_max", "lag"),
        plot.type = "persp",
        xlab = "max WBGT (°C)",
        ylab = "lag (days)",
        zlab = "deaths",
        theta = 60,
        phi = 15,
        r = sqrt(3),
        d = 1,
        type = "response",
        ticktype = "detailed")

The plot can be found here:
https://stackoverflow.com/questions/72884763/space-between-axis-title-and-tick-labels-in-persp-plot-in-r-using-vis-gam

On the x and z-axes, the axis title and axis labels are plotted over each other.


I would like to:

1) increase the space between the axis titles and the tick labels for
the x and z- axes (WBGT and deaths) and
2) increase the space between the ticks and the tick labels.

I've looked up similar posts on StackOverflow, which suggest adding
the following code to the plot (and change the values for the
currently stated defaults):

par(mgp=c(3,1,0))

like

library(mgcv)
par(mgp=c(20,20,20))
vis.gam(x = a1b,
        view = c("wbgt_max", "lag"),
        etc.

However, this changes nothing at all to the plot. (I tried with c(20,
20, 20) , smaller values and larger ones).

Would be grateful for any suggestions!

Jade



More information about the R-help mailing list