hello,
I wonder whether there is a way to plot in R the following:
I have two arrays of dimension (200*1) say x1 and x2.
I would like to plot on the same graph x1[1:50,]*x2[1:50,] with pch=1
x1[51:100,]*x2[51:100,] with pch=2
x1[101:150,]*x2[101:150,] with pch=3
x1[151:200,]*x2[151:200,] with pch=4
is it possible with the "plot" function? Or do I have to plot
4differents graphs?
THanks in advance.
nicolas
plot
6 messages · NICOLAS DEIG, Dimitris Rizopoulos, Uwe Ligges +2 more
try this: x1 <- as.matrix(rnorm(200)) x2 <- as.matrix(rnorm(200)) ############### dim(x1) <- dim(x2) <- c(50,4) matplot(x1,x2, pch=1:4, col=1) Best, Dimitris ---- Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm ----- Original Message ----- From: "NICOLAS DEIG" <nicolas.deig at epfl.ch> To: <r-help at stat.math.ethz.ch> Sent: Friday, January 28, 2005 11:22 AM Subject: [R] plot
hello,
I wonder whether there is a way to plot in R the following:
I have two arrays of dimension (200*1) say x1 and x2.
I would like to plot on the same graph x1[1:50,]*x2[1:50,] with
pch=1
x1[51:100,]*x2[51:100,] with
pch=2
x1[101:150,]*x2[101:150,] with
pch=3
x1[151:200,]*x2[151:200,] with
pch=4
is it possible with the "plot" function? Or do I have to plot
4differents graphs?
THanks in advance.
nicolas
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
NICOLAS DEIG wrote:
hello,
I wonder whether there is a way to plot in R the following:
I have two arrays of dimension (200*1) say x1 and x2.
I would like to plot on the same graph x1[1:50,]*x2[1:50,] with pch=1
x1[51:100,]*x2[51:100,] with pch=2
x1[101:150,]*x2[101:150,] with pch=3
x1[151:200,]*x2[151:200,] with pch=4
You can specify pch in form of a vector (as long as x1) as in: plot(1:10, pch=rep(1:2, each=5)) Uwe Ligges
is it possible with the "plot" function? Or do I have to plot 4differents graphs? THanks in advance. nicolas
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
if * in x1[1:50,]*x2[1:50,] means "times", try :
matplot(matrix(x1,ncol=4)*matrix(x2,ncol=4))
if * means "vs", try :
matplot(matrix(x1,ncol=4),matrix(x2,ncol=4))
-----Message d'origine-----
De : r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch]De la part de NICOLAS DEIG
Envoye : vendredi 28 janvier 2005 14:23
A : r-help at stat.math.ethz.ch
Objet : [R] plot
hello,
I wonder whether there is a way to plot in R the following:
I have two arrays of dimension (200*1) say x1 and x2.
I would like to plot on the same graph x1[1:50,]*x2[1:50,] with pch=1
x1[51:100,]*x2[51:100,] with pch=2
x1[101:150,]*x2[101:150,] with pch=3
x1[151:200,]*x2[151:200,] with pch=4
is it possible with the "plot" function? Or do I have to plot
4differents graphs?
THanks in advance.
nicolas
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
Hello, You search that command : plot(x1,x2,pch=rep(1:4,50)) I think you should read some basic manuals about R, the FAQ, etc ...
NICOLAS DEIG wrote:
hello,
I wonder whether there is a way to plot in R the following:
I have two arrays of dimension (200*1) say x1 and x2.
I would like to plot on the same graph x1[1:50,]*x2[1:50,] with pch=1
x1[51:100,]*x2[51:100,] with pch=2
x1[101:150,]*x2[101:150,] with pch=3
x1[151:200,]*x2[151:200,] with pch=4
is it possible with the "plot" function? Or do I have to plot
4differents graphs?
THanks in advance.
nicolas
Romain FRANCOIS : francoisromain at free.fr page web : http://addictedtor.free.fr/ (en construction) 06 18 39 14 69 / 01 46 80 65 60 _______________________________________________________ Etudiant en 3eme ann?e Institut de Statistique de l'Universit? de Paris (ISUP) Fili?re Industrie et Services http://www.isup.cicrp.jussieu.fr/
Hello, You search that command : plot(x1,x2,pch=rep(1:4,50))
Oups, sorry, I meant that :
plot(x1,x2,pch=rep(1:4,each=50))
^^^^
I need more cafeine on morning !
I think you should read some basic manuals about R, the FAQ, etc ... NICOLAS DEIG wrote:
hello,
I wonder whether there is a way to plot in R the following:
I have two arrays of dimension (200*1) say x1 and x2.
I would like to plot on the same graph x1[1:50,]*x2[1:50,] with
pch=1
x1[51:100,]*x2[51:100,] with pch=2
x1[101:150,]*x2[101:150,] with pch=3
x1[151:200,]*x2[151:200,] with
pch=4
is it possible with the "plot" function? Or do I have to plot
4differents graphs?
THanks in advance.
nicolas
Romain FRANCOIS : francoisromain at free.fr page web : http://addictedtor.free.fr/ (en construction) 06 18 39 14 69 / 01 46 80 65 60 _______________________________________________________ Etudiant en 3eme ann?e Institut de Statistique de l'Universit? de Paris (ISUP) Fili?re Industrie et Services http://www.isup.cicrp.jussieu.fr/