[R] x,y plot question (two sets of labels)
Jonathan Greenberg
greenberg at ucdavis.edu
Thu Jan 21 00:53:46 CET 2010
I'm trying to figure out the best way to do a scatterplot using the
following data as an example:
plothelp_x=1:10
plothelp_A1=sin(plothelp_x)
plothelp_A2=tan(plothelp_x)
plothelp_B=c("A","B","C","A","B","C","A","B","C","A")
(note that all 4 of these vectors have 10 entries each)
What I would like is to have two plots on the same graph:
1) plothelp_A1 vs. plothelp_x
2) plothelp_A2 vs. plothelp_x
I want plot #1 to have a set symbol SHAPE (say, crosses) and plot #2 a
different symbol shape (say, dots). On top of that, I want all points
to be color coded based on plothelp_B, e.g. all As are black, all Bs are
red, all Cs are blue; e.g a sin point with the letter "A" should be a
black cross, a tan point with the letter C should be a red dot.
Finally, I'd like two have TWO keys in the graph showing a) what the
symbol shapes represent (e.g. cross=sin, dot=tan), and b) what the
colors mean.
Thanks for any help you can give me!
--j
--
Jonathan A. Greenberg, PhD
Postdoctoral Scholar
Center for Spatial Technologies and Remote Sensing (CSTARS)
University of California, Davis
One Shields Avenue
The Barn, Room 250N
Davis, CA 95616
Phone: 415-763-5476
AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307
More information about the R-help
mailing list