Personalize the color of the confidence interval bars of an plot.effects() R

Viewed 145

Good morning, I'm talking about plot.effects of the R package "effects", https://cran.r-project.org/web/packages/effects/effects.pdf

I would like to personalize the color of the confidence interval bars of an plot.effects().

confint=list(style="bars",color="black") looks not working, the parameters of the colors of the confidence intervals are taken from the color of lines.

This is the code I use:

#remove all the axis
trellis.par.set(list(axis.line = list(col = c(0))))
my.theme <- list(
  axis.components = list(top = list(tck = 0, pad1 = 0, pad2 = 0),
                       right = list(tck = 0,pad1 = 0, pad2 = 0)))
trellis.par.set(theme = my.theme)

#add only bottom and left axis  
myAxisFun <- function(side, line.col, ...) {
  if (side == "left") {
    grid.lines(x = c(0, 0), y = c(0, 1), default.units = "npc")
  } else if (side == "bottom") {
    grid.lines(x = c(0, 1), y = c(0, 0), default.units = "npc")
  }
  axis.default(side = side, line.col = 1, ...)  
}


plot(A2[1],main="Interaction between Subtopic and Condition",ylab="Response Accuracy",
     lines=list(multiline=T,col=c( "#CC6677","#332288", "#88CCEE"),lty=1:3,lwd=c(2,2,2)),
     confint=list(style="bars",color="black"), #add the confidence interval
     #band.colors=c("black","black","black"), 
     #residuals.color="black",
     #confint.col="black",
     axis = myAxisFun,
     symbols=list(pch=c(NA, NA, NA, 1, 1, 1, 1))) #remove simbols

Commented inside the function there are the other parameters I tried to set, without any results.

Maybe the solution is a personalized function as I used to the axis? (reference Hide top x-axis in doubleYScale plot in R)

The blue arrow point to one of the band which I would change the color.

result of the previous code

I hope the request is enough clear, thanks to everyone who could help.

1 Answers

At the moment, I find a suboptimal solution which consist of modify the colors of the bar in the PDF printed graph using GIMP. That program allows you to do not lose the PDF quality of the image and manually adjust the details who you need.

Related