[R-sig-eco] assign unique pch characters to a string of rows
Maaike Versteegh
m.a.versteegh at rug.nl
Tue Oct 5 13:04:26 CEST 2010
Hello jenna,
Alternatively you could use the library lattice and make a xyplot. I am
also assuming (like Jose) that you have a variable called "date", which
indicates the groups that you want to appear with different symbols. The
code would then be:
library(lattice)
xyplot(data$sarp_avg ~data$cstar_avg, groups=data$date, xlim=c(0,3),
ylim=c(0,3.5),
xlab="CSTAR LAI", ylab="SARP LAI", main="PISTACHIOS JUNE 27- JULY 14",
pch=c(1,6,8,15,17), col="black")
Cheers,
Maaike
José M. Blanco Moreno wrote:
> Hello,
> Sometimes I have used a named vector of pch such as:
> pch.vec <- c('june_2728'=1,'june_2829'=6,
> 'june_29'=8,'july_01'=15,'july_14' =17)
>
> and, suposing that these dates are stored in a vector called date,
> then use them as follows:
>
> plot(data$sarp_avg ~data$cstar_avg, xlim=c(0,3), ylim=c(0,3.5),
> xlab="CSTAR LAI", ylab="SARP LAI", main="PISTACHIOS JUNE 27- JULY 14",
> pch=pch.vec[date])
>
> (a quick answer with no checking, use with caution!)
>
>
>
>
> Al 30/09/2010 22:53, En/na jenna martin ha escrit:
>> Hi -
>>
>> I am trying to assign a unique pch character to 5 different sections
>> of one
>> row.
>> For example, in my data set, i would like a unique character
>> representing
>> each group of rows (one character rep's the multiple values for each
>> date,
>> so 5 unique values for 5 dates)
>>
>> rows 1:26 are attached to june_2728, and
>> rows 27:78 are june_2829
>> rows 79:104 are june_29
>> rows 105:114 are july_01
>> rows 115:146 are july_14
>>
>> I tried
>>
>>> plot(data$sarp_avg ~data$cstar_avg, xlim=c(0,3), ylim=c(0,3.5),
>> xlab="CSTAR LAI", ylab="SARP LAI", main="PISTACHIOS JUNE 27- JULY 14",
>> pch=c(1,6,8,15,17))
>>
>>
>> but I have a feeling it is just recycling the 5 pch values, instead of
>> assigning them to the specific string of rows.
>>
>> Thanks for any help you might have!!
>>
>> [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-ecology mailing list
>> R-sig-ecology at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>
--
Maaike Versteegh
Animal Ecology Group
University of Groningen
PO Box 14
9750 AA Haren
The Netherlands
phone +31 50 363 3408
fax +31 50 363 5205
e-mail m.a.versteegh at rug.nl
More information about the R-sig-ecology
mailing list