2012年12月28日星期五

How to Add an Extra Vertical Axis to R Plots

http://www.carlislerainey.com/2012/12/28/how-to-add-an-extra-vertical-axis-to-r-plots/?utm_source=rss&utm_medium=rss&utm_campaign=how-to-add-an-extra-vertical-axis-to-r-plots


set.seed(3571)
n <- 100="100" br="br">a1 <- br="br" n="n" rnorm="rnorm">a2 <- br="br" n="n" rnorm="rnorm">
x <- br="br" null="null">y <- code="code" null="null">
x[1] <- a1="a1" br="br">y[1] <- a2="a2" code="code">
for (t in 2:n) {
x[t] <- -.2="-.2" .5=".5" a1="a1" br="br" t-1="t-1" t="t" x="x" y="y">y[t] <- a2="a2" br="br" t-1="t-1" t="t" y="y">}
par(mar = c(5,5,2,5))
plot(ts(x), ylab = \"x\")
par(new = T)
plot(ts(y), col = \"red\", axes = F, xlab = NA, ylab = NA)
axis(side = 4)
mtext(side = 4, line = 3, \"y\")

没有评论:

发表评论