Rafael Barros de Rezende
2007-Oct-26 00:09 UTC
[R] How to plot multiple variables on the same graph
How to plot multiple variables on the same graph Dear R users, I want to plot the following variables (a, b, c) on the same graph. The x-axis must be the variable mat and the graph must have the type = "l". How can I do that?? > a [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 > b [1] 0.90665296 0.82473871 0.75269217 0.68917606 0.63304639 0.58332339 [7] 0.53916690 0.49985555 0.46476916 0.37987824 0.30067069 0.20731536 [13] 0.13927000 0.10452521 0.08362549 > c [1] 0.08734889 0.15347956 0.20272682 0.23858721 0.26387711 0.28086150 [7] 0.29135865 0.29682524 0.29842560 0.28839505 0.25944938 0.19894618 [13] 0.13850436 0.10445517 0.08361908 > mat [1] 1 2 3 4 5 6 7 8 9 12 16 24 36 48 60 Thanks!! Rafael Barros de Rezende MPhill Economics Candidate - Curriculum Lattes: [1]http://lattes.cnpq.br/9826095609825249 Cedeplar - Development and Regional Planning Center Face, UFMG ([2]http://www.cedeplar.ufmg.br) -- Esta mensagem foi verificada pelo sistema de antiv??rus e acredita-se estar livre de perigo. References 1. http://lattes.cnpq.br/9826095609825249 2. http://www.cedeplar.ufmg.br/
Moshe Olshansky
2007-Oct-26 00:39 UTC
[R] How to plot multiple variables on the same graph
Is this what you need?> plot(mat,a,type="l",col="red",ylim=c(0,1)) > lines(mat,b,col="green") > lines(mat,c,col="blue")--- Rafael Barros de Rezende <rafabarros at cedeplar.ufmg.br> wrote:> > How to plot multiple variables on the same graph > > Dear R users, > > I want to plot the following variables (a, b, c) > on the same graph. The > x-axis must be the variable mat and the graph > must have the type = "l". How > can I do that?? > > > a > [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 > > b > [1] 0.90665296 0.82473871 0.75269217 0.68917606 > 0.63304639 0.58332339 > [7] 0.53916690 0.49985555 0.46476916 0.37987824 > 0.30067069 0.20731536 > [13] 0.13927000 0.10452521 0.08362549 > > c > [1] 0.08734889 0.15347956 0.20272682 0.23858721 > 0.26387711 0.28086150 > [7] 0.29135865 0.29682524 0.29842560 0.28839505 > 0.25944938 0.19894618 > [13] 0.13850436 0.10445517 0.08361908 > > mat > [1] 1 2 3 4 5 6 7 8 9 12 16 24 36 48 60 > > Thanks!! > Rafael Barros de Rezende > MPhill Economics Candidate - Curriculum Lattes: > [1]http://lattes.cnpq.br/9826095609825249 > Cedeplar - Development and Regional Planning > Center > Face, UFMG ([2]http://www.cedeplar.ufmg.br) > -- > Esta mensagem foi verificada pelo sistema de > antiv??rus e > acredita-se estar livre de perigo. > > References > > 1. http://lattes.cnpq.br/9826095609825249 > 2. http://www.cedeplar.ufmg.br/ > ______________________________________________ > 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. >
matplot(mat, cbind(a,b,c)) On 10/25/07, Rafael Barros de Rezende <rafabarros at cedeplar.ufmg.br> wrote:> > How to plot multiple variables on the same graph > > Dear R users, > > I want to plot the following variables (a, b, c) on the same graph. The > x-axis must be the variable mat and the graph must have the type = "l". How > can I do that?? > > > a > [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 > > b > [1] 0.90665296 0.82473871 0.75269217 0.68917606 0.63304639 0.58332339 > [7] 0.53916690 0.49985555 0.46476916 0.37987824 0.30067069 0.20731536 > [13] 0.13927000 0.10452521 0.08362549 > > c > [1] 0.08734889 0.15347956 0.20272682 0.23858721 0.26387711 0.28086150 > [7] 0.29135865 0.29682524 0.29842560 0.28839505 0.25944938 0.19894618 > [13] 0.13850436 0.10445517 0.08361908 > > mat > [1] 1 2 3 4 5 6 7 8 9 12 16 24 36 48 60 > > Thanks!! > Rafael Barros de Rezende > MPhill Economics Candidate - Curriculum Lattes: > [1]http://lattes.cnpq.br/9826095609825249 > Cedeplar - Development and Regional Planning Center > Face, UFMG ([2]http://www.cedeplar.ufmg.br) > -- > Esta mensagem foi verificada pelo sistema de antiv?rus e > acredita-se estar livre de perigo. > > References > > 1. http://lattes.cnpq.br/9826095609825249 > 2. http://www.cedeplar.ufmg.br/ > ______________________________________________ > 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. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve?
Rafael Barros de Rezende
2007-Oct-26 12:51 UTC
[R] How to plot multiple variables on the same graph
Thanks a lot Rafael Barros de Rezende Mestrando em Economia - Curr??culo Lattes: [1]http://lattes.cnpq.br/9826095609825249 Cedeplar Centro de Desenvolvimento e Planejamento Regional Face, UFMG ([2]http://www.cedeplar.ufmg.br) ---------- Original Message ----------- From: Moshe Olshansky <m_olshansky at yahoo.com> To: Rafael Barros de Rezende <rafabarros at cedeplar.ufmg.br>, r-help at stat.math.ethz.ch Sent: Thu, 25 Oct 2007 17:39:38 -0700 (PDT) Subject: Re: [R] How to plot multiple variables on the same graph > Is this what you need? > > > plot(mat,a,type="l",col="red",ylim=c(0,1)) > > lines(mat,b,col="green") > > lines(mat,c,col="blue") > > --- Rafael Barros de Rezende > <rafabarros at cedeplar.ufmg.br> wrote: > > > > > How to plot multiple variables on the same graph > > > > Dear R users, > > > > I want to plot the following variables (a, b, c) > > on the same graph. The > > x-axis must be the variable mat and the graph > > must have the type = "l". How > > can I do that?? > > > > > a > > [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 > > > b > > [1] 0.90665296 0.82473871 0.75269217 0.68917606 > > 0.63304639 0.58332339 > > [7] 0.53916690 0.49985555 0.46476916 0.37987824 > > 0.30067069 0.20731536 > > [13] 0.13927000 0.10452521 0.08362549 > > > c > > [1] 0.08734889 0.15347956 0.20272682 0.23858721 > > 0.26387711 0.28086150 > > [7] 0.29135865 0.29682524 0.29842560 0.28839505 > > 0.25944938 0.19894618 > > [13] 0.13850436 0.10445517 0.08361908 > > > mat > > [1] 1 2 3 4 5 6 7 8 9 12 16 24 36 48 60 > > > > Thanks!! > > Rafael Barros de Rezende > > MPhill Economics Candidate - Curriculum Lattes: > > [1][3]http://lattes.cnpq.br/9826095609825249 > > Cedeplar - Development and Regional Planning > > Center > > Face, UFMG ([2][4]http://www.cedeplar.ufmg.br) > > -- > > Esta mensagem foi verificada pelo sistema de > > antiv??rus e > > acredita-se estar livre de perigo. > > > > References > > > > 1. [5]http://lattes.cnpq.br/9826095609825249 > > 2. [6]http://www.cedeplar.ufmg.br/ > > ______________________________________________ > > R-help at r-project.org mailing list > > [7]https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > > [8]http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, > > reproducible code. > > > > -- > Esta mensagem foi verificada pelo sistema de antiv??rus e > acredita-se estar livre de perigo. ------- End of Original Message ------- -- Esta mensagem foi verificada pelo sistema de antiv??rus e acredita-se estar livre de perigo. References 1. http://lattes.cnpq.br/9826095609825249 2. http://www.cedeplar.ufmg.br/ 3. http://lattes.cnpq.br/9826095609825249 4. http://www.cedeplar.ufmg.br/ 5. http://lattes.cnpq.br/9826095609825249 6. http://www.cedeplar.ufmg.br/ 7. https://stat.ethz.ch/mailman/listinfo/r-help 8. http://www.r-project.org/posting-guide.html