[R] Plot of multiple data sets

Romain Francois francoisromain at free.fr
Wed Sep 7 17:09:07 CEST 2005


Le 07.09.2005 16:00, Stéphane Mattei a écrit :

>Thank you all for your answers.
>
>I eventually use the points command
>
>plot(MATRIX[,1])
>points(MATRIX[,2])
>points(MATRIX[,3])
>...
>
>with matplot I had numbers instead of points with type="p" and par(new=TRUE) makes complications
>with the axis.
>  
>
So, add pch=21 or something else to your matplot call and you won't need 
an extra package for that.

R> matplot(iris[,1:4], type="p", pch=21)

Also, if you want to do it with plot and points, you must specify the y 
range like that :

R> plot(MATRIX[,1], ylim=range(MATRIX))
R> points(MATRIX[,2])
R> points(MATRIX[,3])

Proceeding that way, par(new=TRUE) won't make complications anymore.

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~
~~~~~~      Romain FRANCOIS - http://addictedtor.free.fr         ~~~~~~
~~~~        Etudiant  ISUP - CS3 - Industrie et Services           ~~~~
~~                http://www.isup.cicrp.jussieu.fr/                  ~~
~~~~           Stagiaire INRIA Futurs - Equipe SELECT              ~~~~
~~~~~~   http://www.inria.fr/recherche/equipes/select.fr.html    ~~~~~~
~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~




More information about the R-help mailing list