Hi, I try to make a plot like this: Y | | | o | o o | o o | o o |o o o |-------------------------------- 0 10 20 30 40 50 60 70 80 90 100 (A) 100 90 80 70 60 50 40 30 20 10 0 (B) or B 100 90 80 70 60 50 40 30 20 10 0 Y |-------------------------------- | | o | o o | o o | o o |o o o |-------------------------------- 0 10 20 30 40 50 60 70 80 90 100 A A and B are complementary variables. How is the best way to make this plot? Thanks Ronaldo --> Prof. Ronaldo Reis J?nior| .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional | : :' : Campus Universit?rio Prof. Darcy Ribeiro, Vila Mauric?ia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8187 | ronaldo.reis em unimontes.br | chrysopa em gmail.com | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366
On 12/13/2007 8:16 AM, Ronaldo Reis Junior wrote:> Hi, > > I try to make a plot like this: > > Y | > | > | o > | o o > | o o > | o o > |o o o > |-------------------------------- > 0 10 20 30 40 50 60 70 80 90 100 (A) > 100 90 80 70 60 50 40 30 20 10 0 (B) > > or > B > 100 90 80 70 60 50 40 30 20 10 0 > Y |-------------------------------- > | > | o > | o o > | o o > | o o > |o o o > |-------------------------------- > 0 10 20 30 40 50 60 70 80 90 100 > A > > A and B are complementary variables. > > How is the best way to make this plot? >Plot Y versus A, then use the axis() function to add another axis and mtext to label it. For example, Y <- rnorm(101) A <- 0:100 plot(A, Y) B <- 100-A ticks <- pretty(B) axis(side=3, at=100-ticks, labels=ticks) mtext("B", side=3, line=3) You may need to adjust par(mar=) to get large enough margins for some more elaborate versions. Duncan Murdoch
Something like this?> x<-0:100 > y<-dnorm(x,50,20) > plot(x,y) > axis(3,seq(0,100,by=20),labels=seq(100,0,by=-20))On 12/13/07, Ronaldo Reis Junior <chrysopa at gmail.com> wrote:> Hi, > > I try to make a plot like this: > > Y | > | > | o > | o o > | o o > | o o > |o o o > |-------------------------------- > 0 10 20 30 40 50 60 70 80 90 100 (A) > 100 90 80 70 60 50 40 30 20 10 0 (B) > > or > B > 100 90 80 70 60 50 40 30 20 10 0 > Y |-------------------------------- > | > | o > | o o > | o o > | o o > |o o o > |-------------------------------- > 0 10 20 30 40 50 60 70 80 90 100 > A > > A and B are complementary variables. > > How is the best way to make this plot? > > Thanks > Ronaldo > -- > > Prof. Ronaldo Reis J?nior > | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional > | : :' : Campus Universit?rio Prof. Darcy Ribeiro, Vila Mauric?ia > | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil > | `- Fone: (38) 3229-8187 | ronaldo.reis at unimontes.br | chrysopa at gmail.com > | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366 > > ______________________________________________ > 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. >-- David Barron Said Business School Jesus College Park End Street Oxford Oxford OX1 1HP OX1 3DW 01865 288906 01865 279684
> I try to make a plot like this: > > Y | > | > | o > | o o > | o o > | o o > |o o o > |-------------------------------- > 0 10 20 30 40 50 60 70 80 90 100 (A) > 100 90 80 70 60 50 40 30 20 10 0 (B)x = seq(10,100,10) y = runif(10) plot(x,y) par(mgp = c(3,2,0)) Axis(side=1, at=x, labels=rev(x))> or > B > 100 90 80 70 60 50 40 30 20 10 0 > Y |-------------------------------- > | > | o > | o o > | o o > | o o > |o o o > |-------------------------------- > 0 10 20 30 40 50 60 70 80 90 100 > ACode as before, but without the par statement, and using Axis(side=3, ...) Regards, Richie. Mathematical Sciences Unit HSL ------------------------------------------------------------------------ ATTENTION: This message contains privileged and confidential inform...{{dropped:20}}
There is probably a better way but something like this should do it for your second version. aa <- 1:20 bb <- c(5,10,15,20 ) cc <- c(25, 50, 75, 100) plot(aa) axis(side=3, labels=cc, at=bb) --- Ronaldo Reis Junior <chrysopa at gmail.com> wrote:> Hi, > > I try to make a plot like this: > > Y | > | > | o > | o o > | o o > | o o > |o o o > |-------------------------------- > 0 10 20 30 40 50 60 70 80 90 100 (A) > 100 90 80 70 60 50 40 30 20 10 0 (B) > > or > B > 100 90 80 70 60 50 40 30 20 10 0 > Y |-------------------------------- > | > | o > | o o > | o o > | o o > |o o o > |-------------------------------- > 0 10 20 30 40 50 60 70 80 90 100 > A > > A and B are complementary variables. > > How is the best way to make this plot? > > Thanks > Ronaldo > -- > > Prof. Ronaldo Reis J?nior > | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de > Biologia Computacional > | : :' : Campus Universit?rio Prof. Darcy Ribeiro, > Vila Mauric?ia > | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG > - Brasil > | `- Fone: (38) 3229-8187 | > ronaldo.reis at unimontes.br | chrysopa at gmail.com > | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | > LinuxUser#: 205366 > > ______________________________________________ > 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. >