I am representing the "nature" of an interaction amongst independent variables via a line graph, on this graph the nature of the interaction changes above and below the calculated value w0. Below this value, there is a buffering effect and above there is a magnification effect. I want to represent the magnification effect with a green line and the buffering effect with a red line.
When using a line, the line does not change colors according to the conditional. However, when I use points instead, the points change colors correctly but the points are so sparse that it is hard to measure the results.
I have played around with the ifelse() function trying to change the color of the line, but as stated previously, it does not work with the line only the points.
wLow = 0
w0 = 1.49
wHigh = 4
z = yaxis <- c(1,2,3)
t = xaxis <- c(wLow,w0,wHigh)
distPlot <- plot(t,z, type="b", lwd=5, pch=15, col = ifelse( t <
w0,'red','green'), xlab="Moderator Range", ylab="Effect")
Optimally, I would like the line below w0 to be red and above to be green or if this is not possible, could we create a line of points of the correct color between the 3 given points?