0

community, I have a problem with a plot for my meta analysis with moderators. Unfortunately my error bars overlap. Which is why I am searching for an opportunity to shift my lines a few inches. I know the dodge.position function in ggplot. Is there a similar function in the "normal" plot function?

This is my code:

plot(coef.rma(meta_LGOOCBdimension_MI)[1:3], type="o", pch=19, ylim=c(0, 1.2), 
     xlab="OCB Dimension", ylab="Standardized Correlation", xaxt="n", bty="l") 
arrows(x0=1:3, y0=coef(summary(meta_LGOOCBdimension_MI))$ci.lb[1:3], x1=1:3,
       y1=coef(summary(meta_LGOOCBdimension_MI))$ci.ub[1:3], code=3, angle=90, length=0.05) 
axis(side=1, at=1:3, labels=c("OCB-I","OCB-O","OCB-CH")) 
lines(coef.rma(meta_LGOOCBdimension_MI)[4:5], type="o", pch=15, lty="dotted") 
arrows(x0=1:2, y0=coef(summary(meta_LGOOCBdimension_MI))$ci.lb[4:5], x1=1:2, 
       y1=coef(summary(meta_LGOOCBdimension_MI))$ci.ub[4:5], code=3, angle=90, length=0.05) 
lines(coef.rma(meta_LGOOCBdimension_MI)[6:8], type="o", pch=17, lty="dashed")
arrows(x0=1:3, y0=coef(summary(meta_LGOOCBdimension_MI))$ci.lb[6:8], 
       x1=1:3, y1=coef(summary(meta_LGOOCBdimension_MI))$ci.ub[6:8],
       code=3, angle=90, length=0.05) 
legend("topright", legend=c("vandewalle", "button", "other"), 
       lty=c("solid", "dotted", "dashed"), pch=c(19,15, 17)) 
title("Estimated Average Effects based on the Interaction Model")

Which leads to this output:

enter image description here

4

1 回答 1

0

我找到了以下调整 x 值的解决方案:

plot(c(1,2,3), coef.rma(meta_LGOOCBdimension_MI)[1:3], type="o", pch=19, 
     xlim=c(1,3.2), ylim=c(0,1.2), xlab="OCB Dimension", 
     ylab="Standardized Correlation", xaxt="n", bty="l")
arrows(x0=1:3, y0=coef(summary(meta_LGOOCBdimension_MI))$ci.lb[1:3], 
       x1=1:3, y1=coef(summary(meta_LGOOCBdimension_MI))$ci.ub[1:3], 
       code=3, angle=90, length=0.05)
axis(side=1, at=1:3, labels=c("OCB-I","OCB-O","OCB-CH"))
lines(c(1.05,2.05), coef.rma(meta_LGOOCBdimension_MI)[4:5], type="o", 
      pch=15, lty="dotted")
arrows(x0=c(1.05,2.05), y0=coef(summary(meta_LGOOCBdimension_MI))$ci.lb[4:5],
       x1=c(1.05,2.05), y1=coef(summary(meta_LGOOCBdimension_MI))$ci.ub[4:5], 
       code=3, angle=90, length=0.05)
lines(c(1.1,2.1,3.1), coef.rma(meta_LGOOCBdimension_MI)[6:8], type="o", 
      pch=17, lty="dashed")
arrows(x0=c(1.1,2.1,3.1), y0=coef(summary(meta_LGOOCBdimension_MI))$ci.lb[6:8], 
       x1=c(1.1,2.1,3.1), y1=coef(summary(meta_LGOOCBdimension_MI))$ci.ub[6:8], 
       code=3, angle=90, length=0.05)
legend("topright", legend=c("Vandewalle (1997)", "Button et al. (1996)", "Other"), 
       lty=c("solid", "dotted", "dashed"), pch=c(19,15, 17))
title("Estimated Average Effects based on the Interaction Model")

阴谋:

在此处输入图像描述

于 2019-12-14T12:41:20.267 回答