Skip to content

simple line plots?

2 messages · Ashish Ranpura, Don MacQueen

#
I've spent quite a lot of the day trying to construct a fairly  
standard line plot in R, and I have the feeling there is a simple way  
that I haven't discovered.

I have a large vector of measurements (TIME), and each measurement  
falls into one of three categories (PHASE). For each PHASE value, I  
want a mean of the corresponding TIME measurements plotted as a point  
along with standard error bars. I'd like the three resulting point  
connected with line segments.

I'd like to have two data series like this plotted on the same graph  
-- one in red, one in blue.

Excel, as awful as it is, does this kind of graph quite easily.

After sifting through the scattered documentation, the best I could  
do was to store the mean values of the three points, plot those three  
numbers against the values 1,2, and 3, then use the arrows() function  
to draw error bars on each one. This is a LOT of manual effort, as  
you can imagine (in addition to the means I have to calculate the  
standard errors for each point, and I still don't know how to draw  
each of the three line segments I need).

Any suggestions?

Thanks,

--Ashish.


-----
Ashish Ranpura
Institute of Cognitive Neuroscience
University College London
17 Queen Square
LONDON WC1N 3AR
#
This is a general R question, not a Mac-specific question, so you'll 
get more suggestions if you post on regular R help.

In the meantime,
Help files with alias or concept or title matching 'error bar' using
fuzzy matching:



errbar(Hmisc)           Plot Error Bars
xYplot(Hmisc)           xyplot and dotplot with Matrix Variables to
                         Plot Error Bars and Bands
ncv.test(car)           Score Test for Non-Constant Error Variance
plotCI(gplots)          Plot Error Bars and Confidence Intervals

brings up three possibilities, the functions errbar(), xYplot(), and plotCI().

Keep digging in the documentation. Although I can't tell you exactly 
which one or ones to look in, there is undoubtedly something. If 
nothing else, search the R-help archives.

-Don
At 5:19 PM +0100 9/2/05, Ashish Ranpura wrote: