How to set the font size for the axes in the R plot function cdplot ()

advertisements

I have a simple plot call:

cdplot(example~test)

I would like to make the font of the axes bigger. However,

cdplot(example~test, cex=2.0)

does not work, and I cannot find a solution to this. How do I increase the font size?


Use the par function to circumvent the problem:

#example data from ?cdplot:
fail <- factor(c(2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1,
                 1, 2, 1, 1, 1, 1, 1),
               levels = 1:2, labels = c("no", "yes"))
temperature <- c(53, 57, 58, 63, 66, 67, 67, 67, 68, 69, 70, 70,
                 70, 70, 72, 73, 75, 75, 76, 76, 78, 79, 81)

#save old parameters
old.par <- par(no.readonly = TRUE)
#change only the size of axis, for axis labels use cex.lab etc, see ?par
par(cex.axis=2)
cdplot(fail ~ temperature)
par(old.par) #restore old parameters

From ?cdplot's arguments section:

bw, n, from, to, ... arguments passed to density.

And from ?density's arguments section:

... further arguments for (non-default) methods.

So you cannot use cdplot(fail ~ temperature,cex.axis=2) because the additional parameters "..." are used by density function which doesn't use them as graphical parameters such as cex.