[R] Plotting an interaction with error bars

Dror D Lev dror.teach at gmail.com
Tue Nov 3 12:15:32 CET 2009


Hello.

I need to plot a two-way interaction (5 levels X 3) with error bars.
The x.factor will be the five-levels var and the trace.factor will be
the three level var.

I was able to find functions that draw error bars, but still couldn't
find a way to draw an interaction plot that looks like what is common
in psychological (and related) journals: the lines (three in my need)
are plotted in parallel and to avoid overlapping of the error bars a
small jitter is added.

I was able to make plotmeans() {from gplots} draw the interaction but
with the lines plotted side by side (not parallel), resulting in three
panes of one line each. When I tried manually super-imposing (looping
a draw of one line for each level in the trace.factor) I got the
overall look, but the error bars overlap and are hard to distinguish.

Another attempt I made was with ci.plot() {from pda}. Inputting an
aov() model resulted in a perfect plot of interaction but which is
very limited to handle - I was unable to add a legend, change symbols
etc.

Does anybody knows if there is a way to manipulate either of the above
functions more then what I was able to?
Is there another function to draw interaction plots with error bars?

Thanks for any help or comment.
dror




More information about the R-help mailing list