[R-SIG-Mac] color lines by group membership in spaghetti plot
Federico Calboli
f.calboli at imperial.ac.uk
Fri May 14 18:44:31 CEST 2010
On 14 May 2010, at 17:36, Jack Monpas-Huber wrote:
> Greetings,
>
> I am new to R. Right now I'm most interested in the spaghetti plots
> of achievement over time by student ID associated with longitudinal
> analysis. How can I do a spaghetti plot of all students, but color
> the lines by group membership such as gender or race, and indicate
> this color scheme in the legend? Any advice would be much appreciated.
I suspect this is more for R-help than for R-mac, but I suspect that:
function.for.spaghetti.plot(data, col = your.color.vector)
your.color.vector = a vector of color, of length equal to that of the students, where students that you want to have the same color (say student 1and 3) are coded as the same color (say 'red', 'blue', 'red')
Google spaghetti plots and R, it might prove helpful. And check the help for legend()
F
--
Federico C. F. Calboli
Department of Epidemiology and Biostatistics
Imperial College, St. Mary's Campus
Norfolk Place, London W2 1PG
Tel +44 (0)20 75941602 Fax +44 (0)20 75943193
f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com
More information about the R-SIG-Mac
mailing list