[R] Questions on plotting using zoo toolbox: (1) dual axes (2)legend
ggrothendieck at gmail.com
Thu Mar 22 13:07:56 CET 2012
On Thu, Mar 22, 2012 at 4:38 AM, jpm miao <miaojpm at gmail.com> wrote:
> I have three time series and I would like to plot them on the same graph
> such that two of them share left y-axis and the third uses right y-axis.
> x1 <- read.csv(file="120322DBCdata.csv", header=TRUE)
> x1zoo<-zoo(x1, x1date, frequency=4)
> x1zoodata<-cbind(x1zoo$D4GDP, x1zoo$D4NE, x1zoo$CEPDexpansion)
> plot(x1zoodata, screen=1)
> My questions are:
> 1. How can I have the second y-axis on the right?
> The only legend shown in the graph is "x1zoodata", but I would like to
> see the names of the components, namely, "D4GDP", "D4NE" and
> "CEPDrecession". How can I do it?
See the double axis example in the examples section of ?plot.zoo
(Also read the last two lines of every message to r-help and
particularly note the part about posting reproducible examples.)
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
email: ggrothendieck at gmail.com
More information about the R-help