Re: [R] plot multiple data sets on same axis

From: Scott Lamb <slamb_at_slamb.org>
Date: Sun, 30 Dec 2007 17:26:28 -0800

Thank you - that was exactly what I needed. I just discovered read.csv understands URLs, so here it is with my actual data and formatting:

    df <- read.csv("http://www.slamb.org/tmp/one-active.csv")     split.df <- split(df, df$method)
    plot(0, xlim=range(df$inactive), ylim=range(df$elapsed), type="n",

         ylab="time (Ás)", xlab="inactive file descriptors", log="y",
         main="1 active descriptor, 1 write", bty="l")
    grid()
    for (i in seq_along(split.df)) {

        lines(split.df[[i]]$inactive, split.df[[i]]$elapsed, col=i)     }
    legend("topleft", legend=labels(split.df),

           fill=seq_along(split.df), bty="n")

Next question. Rather than plot each point, I'd like to use boxplots to show the interquartile range for each x.

I've tried replacing the for loop body with this:

    this_method <- split.df[[i]]
    boxplot(elapsed~inactive, data=this_method,

            add=TRUE, border=i, boxfill=i, outline=FALSE)

but it has two problems:

Not sure how to correct either.

Cheers,
Scott

-- 
Scott Lamb <http://www.slamb.org/>

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Mon 31 Dec 2007 - 01:31:07 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 31 Dec 2007 - 02:30:21 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.