Hi Tsjerk Thank you but the color always remains black ! I would want that the color changes on the same graph (color = 3 on the 4 first steps, col = 4 on 5 following steps....
Michel Le 16/09/2013 09:01, Tsjerk Wassenaar a écrit : > Hi Michel, > > lines(xx,yy,col=zz-2,type="s") > > If you use a color vector, say cols, then you can also do > > lines(xx,yy,col=cols[zz-2],type="s") > > Hope it helps, > > Tsjerk > > > On Mon, Sep 16, 2013 at 8:42 AM, Arnaud Michel <[email protected] > <mailto:[email protected]>> wrote: > > Hi > > I have the following problem : > I have 3 vectors xx, yy, zz : > xx <- c(5479, 6209, 6940, 7670, 8766, 9496, 10227, 11048, > 11778, 12509, 13239, 13970, > 14700, 15340, 15948) > yy <- c( 267, 275, 281, 287, 296, 306, 316, 325, 334, 351, 365, > 377, 389, 419, 419) > zz <- c( 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6) > I would like a line wich join the points (xx, yy) with stair steps > (as type = "s") > plot(xx, yy, type="n") > lines(xx, yy, type ="s") > but I want to change the color according to the value of zz > (exemple : col = 1 if zz =3 ; col =2 if zz= 4 ; col =3 if zz= 5 ; > col =4 if zz= 6) > Thank you for your help > > -- > Michel ARNAUD > Chargé de mission auprès du DRH > DGDRD-Drh - TA 174/04 > Av Agropolis 34398 Montpellier cedex 5 > tel : 04.67.61.75.38 > fax : 04.67.61.57.87 > port: 06.47.43.55.31 > > ______________________________________________ > [email protected] <mailto:[email protected]> 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. > > > > > -- > Tsjerk A. Wassenaar, Ph.D. > -- Michel ARNAUD Chargé de mission auprès du DRH DGDRD-Drh - TA 174/04 Av Agropolis 34398 Montpellier cedex 5 tel : 04.67.61.75.38 fax : 04.67.61.57.87 port: 06.47.43.55.31 [[alternative HTML version deleted]]
______________________________________________ [email protected] 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.

