plot.ts() provides a convenient way to visualize multivariate time series. Unfortunately, I can't figure out how to annotate the (repeated) horizontal axes with Greek letters. The familiar approach for inserting Greek letters seems not to work and nor do some less clever approaches I've tried:
testdata = matrix(rnorm(300), ncol = 3)
# doesn't work
plot.ts(testdata, ylab = expression(paste(pi[0], " = 0")))
# doesn't work
plot.ts(testdata, ylab = c(expression(paste(pi[0], " = 0")),
expression(paste(pi[0], " = 1")),
expression(paste(pi[0], " = 2"))))
# doesn't work
colnames(testdata) = c(expression(paste(pi[0], " = 0")),
expression(paste(pi[0], " = 1")),
expression(paste(pi[0], " = 2")))
plot.ts(testdata)
# doesn't work
plot.ts(testdata, ylab = parse(text = y))
I've run out of ideas ...
There is a solution using library(zoo)
testdata = matrix(rnorm(300), ncol = 3)
plot(zoo::as.zoo(testdata),ylab=c(expression(mu),expression(sigma),expression(beta)),main="Win!")

adapted from http://r.789695.n4.nabble.com/How-to-change-the-label-in-plot-ts-td796114.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With