Dear R experts, I want to plot a line chart with another secondary axis placed right to the standard secondary axis which one can access with the axis command, so that the data lines are seen in the same plot. Is there any way to do this in R? Many thanks, Kirsten.
hey Kirsten, did type ?axis it may help. eg: plot(rnorm(100),axes=F) axis(1) axis(3,at=seq(0,50,length=3),labels=c("A","B","C")) axis(2) axis(4,at=seq(-2,2,length=10),labels=1:10) Best, Patrizio 2009/1/14 Kirsten Thonicke <Kirsten.Thonicke at pik-potsdam.de>:> Dear R experts, > I want to plot a line chart with another secondary axis placed right to > the standard secondary axis which one can access with the axis command, so > that the data lines are seen in the same plot. Is there any way to do this > in R? > Many thanks, > Kirsten. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
Hi Kirsten, If i understood correctly, i think you probably want something like the following: ## R Start... library(plotrix) x1<-1:10; y1<-1:10; x2<-1:15; y2<-15:1 twoord.plot(x1, y1, x2, y2, xlab="Sequence", ylab="Ascending values", rylab="Descending values", main="Two Y-Axis example") ### R end. Hope that helps a little, Tony Breyal On 14 Jan, 09:29, "Kirsten Thonicke" <Kirsten.Thoni... at pik-potsdam.de> wrote:> Dear R experts, > ? ? I want to plot a line chart with another secondary axis placed right to > the standard secondary axis which one can access with the axis command, so > that the data lines are seen in the same plot. Is there any way to do this > in R? > > Many thanks, > Kirsten. > > ______________________________________________ > R-h... at r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
In the zoo package the example section of ?plot.zoo has an example. The same technique works even if you are not using zoo. On Wed, Jan 14, 2009 at 4:29 AM, Kirsten Thonicke <Kirsten.Thonicke at pik-potsdam.de> wrote:> Dear R experts, > I want to plot a line chart with another secondary axis placed right to > the standard secondary axis which one can access with the axis command, so > that the data lines are seen in the same plot. Is there any way to do this > in R? > Many thanks, > Kirsten.