[R] Plotting multiple series of data

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Wed Aug 8 22:24:04 CEST 2001


"Jain, Rahul (Rahul)" <rjain2 at lucent.com> writes:

> I'd like to plot data that's in the form of a table such as this:
> 
> 	1	2	4	6	8	12
> a	10	11	12	14	15	30
> b	2	3	3	4	5	5
> c	1	1	2	2	3	3
> 
> Where the row headers are the results for different series of tests, and the
> column headers are the x-values.
> 
> I'd like to plot this as a set of lines, one each for "a", "b", and "c". I
> can rearrange the data as needed, but I'm wondering if there's an easy way
> to do this in R. I suppose I could just use gnuplot for this plot if it'll
> be simpler, but I'd like to avoid changing the visual style of the graphs
> just for this set.

Here's one way:

matplot(colnames(m),t(m),type="b")


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list