Strecker, Stefan
2003-May-19 09:42 UTC
[R] Line plots with different symbols on the same line
Hello, my data is an ordered list of observations where each observation is either of condition "efficient" (coded as 1) or "non-efficient" (0) as e.g. No. Obs Condition 1 1.1 0 2 1.2 1 3 1.4 1 4 1.5 0 5 2.5 1 etc. My goal is to plot a single line with lty='o' but different symbols for either condition whenever condition is 1 or 0, i.e. on the x-axis the consecutive no. of observation is plotted with the obs on the y-axis as two different symbols (e.g. pch=1 and pch=2). Is there any way to achieve this? Thanks in advance Stefan [[alternate HTML version deleted]]
Philippe Hupé
2003-May-19 09:47 UTC
[R] Line plots with different symbols on the same line
Strecker, Stefan a ?crit :>Hello, > >my data is an ordered list of observations where each observation is either of condition "efficient" (coded as 1) or "non-efficient" (0) as e.g. > >No. Obs Condition >1 1.1 0 >2 1.2 1 >3 1.4 1 >4 1.5 0 >5 2.5 1 >etc. > >My goal is to plot a single line with lty='o' but different symbols for either condition whenever condition is 1 or 0, i.e. on the x-axis the consecutive no. of observation is plotted with the obs on the y-axis as two different symbols (e.g. pch=1 and pch=2). > >Is there any way to achieve this? > >Thanks in advance >Stefan > > > > > > [[alternate HTML version deleted]] > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://www.stat.math.ethz.ch/mailman/listinfo/r-help > >. > > >plot(Obs, data=your_data_frame, pch=c("*","+")[as.factor(Condition)]) see pch for details of symbols available hope this helps. Philippe -- -------------------------------------------------- Philippe Hup? Institut Curie - Equipe Bioinformatique 26, rue d'Ulm - 75005 PARIS France +33 (0)1 42 34 65 29 Philippe.Hupe at curie.fr <mailto:Philippe.Hupe at curie.fr>