[R] Plotting multiple lines

Jonathan Baron baron at psych.upenn.edu
Tue Sep 23 20:35:50 CEST 2003


On 09/23/03 15:49, K Skanes wrote:
>Hi,
>
>I have a data set with 7 years worth of data, and 2 different values (a real 
>value and a model value) of interest in each year for different lengths.  I 
>would like a plot with the year on the y axis and an animal length along the 
>x axis.  For each year I would like to see two lines, one representing real 
>data and one representing model data.  I would like either the model or real 
>line to be red.

One way to do it is with barplot.  You would put your data in a
matrix m1 in which the columns were animals and the rows were
real/model.  (I might have it backward about rows/columns).  The
something like barplot(m1,beside=T) and lots of other options for
labels, colors, line thickness, line spacing, etc., although red
just might turn out to be the default.  Look at the help for
barplot.

-- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page:            http://www.sas.upenn.edu/~baron
R page:               http://finzi.psych.upenn.edu/




More information about the R-help mailing list