Hello, I would like to plot the following matrix: Wk=x achsis. Para 1 = left y-axis as a barplot para 2 right y-axis as a normal scatter plat. I could not find such a solution in any of my documentation. Can someone help me? Thanks a lot Thorsten Wk Para 1 Para 2 31 2000 99.8 32 2005 99.0 33 2002 98.0 34 1090 98.5 35 2001 99.1 36 2010 97.0 37 2010 98.8
Assuming the data are in a data frame called dt, this should work:> plot(dt$Wk,dt$Para1,type="h") > par(new=TRUE) > plot(dt$Wk,dt$Para2,yaxt="n") > axis(4,at=97:100)On 24/11/06, Thorsten Muehge <MUEHGE at de.ibm.com> wrote:> > Hello, > I would like to plot the following matrix: > Wk=x achsis. > Para 1 = left y-axis as a barplot > para 2 right y-axis as a normal scatter plat. > > I could not find such a solution in any of my documentation. > > Can someone help me? > > Thanks a lot > Thorsten > > Wk Para 1 Para 2 > 31 2000 99.8 > 32 2005 99.0 > 33 2002 98.0 > 34 1090 98.5 > 35 2001 99.1 > 36 2010 97.0 > 37 2010 98.8 > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- ================================David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP
Thorsten Muehge wrote:> Hello, > I would like to plot the following matrix: > Wk=x achsis. > Para 1 = left y-axis as a barplot > para 2 right y-axis as a normal scatter plat. > > I could not find such a solution in any of my documentation. > > Can someone help me? > > Thanks a lot > Thorsten > > Wk Para 1 Para 2 > 31 2000 99.8 > 32 2005 99.0 > 33 2002 98.0 > 34 1090 98.5 > 35 2001 99.1 > 36 2010 97.0 > 37 2010 98.8 >Hi Thorsten, Is this what you mean? par(mar=c(5,4,4,4)) xpos<-barplot(mueghe.df$Para.1) axis(1,at=xpos,labels=mueghe.df$Wk) par(new=TRUE) plot(xpos,mueghe.df$Para.2,xlim=par("usr")[1:2],xaxs="i", ylim=c(0,100),type="n",xlab="",ylab="",axes=FALSE) axis(4) points(xpos,mueghe.df$Para.2) Jim