[R] Help with doing overlays plots...

From: Jamieson Cobleigh <cobleigh_at_gmail.com>
Date: Tue 09 Aug 2005 - 03:03:09 EST


I have a data frame with three columns, type (a factor with two values: "Monolithic" and "Compositional"), size (numeric), and states (numeric). I want to create a plot where size goes on the x-axis and states goes on the y-axis. In this plot, I want two lines, one where the type is "Monolithic" and one where the type is "Compositional".

I think this can be done by using the plot command to plot the line for one of the two types (setting the xlim and ylim parameters to ensure the plot area is large enough to hold all of the points). Then, I can use the lines and points commands to add the second line onto the plot.

However, I don't want to have to specify the legend manually. I want something in R that does what can be done in SAS by using "plot states*size=type" in "proc gplot".

Here is a dump of my data set:

tmp <-
structure(list(type = structure(as.integer(c(2, 2, 2, 1, 1, 1, 1, 1)), .Label = c("Compositional", "Monolithic"), class = "factor"),

    size = as.integer(c(2, 3, 4, 2, 3, 4, 5, 6)), states = as.integer(c(4910,     336026, 37526650, 4016, 44941, 310553, 8260254, 144145585     ))), .Names = c("type", "size", "states"), row.names = c("1", "2", "3", "4", "5", "6", "7", "8"), class = "data.frame")



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Aug 09 03:07:36 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:39:45 EST