adam.888
adam.888

Reputation: 7846

R: Inverting second panel of four in multiplot as.zoo

I am able to plot a series of four charts:

library(quantmod)
getSymbols("DJIA",src = "FRED")
getSymbols("DGS10",src = "FRED")
getSymbols("T10Y2Y",src = "FRED")


x <- merge(DJIA, DGS10, T10Y2Y)
tail(x)
plot(as.zoo(x),las=1,main="",mgp=c(1,0.5,0),xlab="")

but how can I invert the chart in the second panel? Thank you for your help.

Upvotes: 0

Views: 33

Answers (1)

G. Grothendieck
G. Grothendieck

Reputation: 269431

To reverse the scale with the lowest value at top and highest value at bottom ylim can be a list with one component per panel. Reverse the limits on T10Y2Y panel. Only components for which the default is to be changed need be specified.

ylim <- list(T10Y2Y = range(T10Y2Y, na.rm = TRUE)[2:1])
plot(as.zoo(x), las = 1, main = "", mgp = c(1, 0.5, 0), xlab = "", ylim = ylim)

Upvotes: 1

Related Questions