Search code examples
rtime-seriesr-base-graphics

plot.ts - change font size of labels & axis.labels


When I plot a time series (f.e. cardox from astsa-package) I am not able to change the fontsize of labels and axis.labels:

library(astsa)
class(cardox)
plot(cardox)
plot(cardox,cex.axis=0.5,cex.lab=0.5,cex=0.5)

The plots look the same, the fontsize didn't change, despite the different cex-attributes.

What is the reason for this behaviour and how can I fix this?

Thanks!


Solution

  • I believe plot.ts does not allow one to pass these parameters as arguments. Instead, try setting the parameters of interest with par(). See the help file ?par for more details on which parameters can be set.

    library(astsa)
    class(cardox)
    par(cex.axis=0.5,cex.lab=0.5,cex=0.5) # set cex with par()
    plot(cardox)
    

    You might also consider astsa::tsplot():

    library(astsa)
    class(cardox)
    par(cex.axis=0.5,cex.lab=0.5,cex=0.5) # set cex with par()
    astsa::tsplot(cardox)