[R] Plotting multiple series of data

Huntsinger, Reid reid_huntsinger at merck.com
Wed Aug 8 22:33:58 CEST 2001


You can use the matplot function on the transpose of your table (without
header): 
matplot(t(table),type="l"). If you give the x-values (top row of your table)
as the first argument, they'll label the x-axis:
matplot(x,t(table),type="l"). Lots of control over colors, styles, etc is
available: see help(matplot).

ts.plot from the time series library also works.

Reid Huntsinger

-----Original Message-----
From: Jain, Rahul (Rahul) [mailto:rjain2 at lucent.com]
Sent: Wednesday, August 08, 2001 3:38 PM
To: 'r-help at lists.r-project.org'
Subject: [R] Plotting multiple series of data


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.

Thanks,
-- 
Rahul Jain
rjain2 at lucent.com
908-559-6024

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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