0

I use interaction.ABC.plot from dea package to visualize the interactions from EEG (electroencephalogram) data, which I use for glm. It works almost fine, but the title and y-axis title are not displayed on plot (default values for titles are used), line width doesn't change on setting lwd parameter and furthermore, I want to add error bars to the plot, but currently have no clue, how to do it. As far as I understand, this can be done by using ggplotFuncs parameter, but I haven't succeeded.

I use R version 3.2.0, Windows 8.1, Rstudio 0.99.489, packages - dae (version 2.7-6), ggplot2.

sample data:

mV = c(runif(16,20,40))
site = rep(c("Fz", "Pz","Fz", "Pz","Fz", "Pz","Fz", "Pz"),2)
gender = rep(c("m","m","f","f","m","m","f","f"),2)
group = rep(c("A","A","A","A","B","B","B","B"),2)
al<-data.frame(mV,site,gender,group)

Here is the code of my usage of interaction.ABC.plot - it is rather straightforward:

library(dae)
library(ggplot2)
interaction.ABC.plot(mV,site,gender,group,data=al, fun="mean", title="Interaction between main factors in alpha-band", xlab("Groups"), ylab("µV"), lwd=10)
  • 1
    When asking for help, you should include a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input data. Also, you should explicitly list any non-standard packages you are using. – MrFlick Feb 29 '16 at 22:48

1 Answers1

0

Though I haven't found solution exactly for interaction.ABC.plot, I've created the necessary plot by using standard ggplot2 options and Rmisc library (to create data summary table). Here's the code:

library(Rmisc)
alsum<-summarySE(al,measurevar = "mV", groupvars = c("site","gender","group"))
# setting position dodge to avoid error bars overlapping
pd <- position_dodge(0.1)
# creating plot; several plots in one area created 
# by using ggplot2 facet_grid() parameter
ggplot(alsum, aes(x=site, y=mV, colour=group)) +
geom_errorbar(aes(ymin=mV-se, ymax=mV+se, group=group),
width=.5, size=1,
position=pd) +
geom_line(aes(group=group), size=1) +
geom_point() +
facet_grid(. ~ gender) 

The resulting plot: Three-factor interaction plot