Hello everyone!
I am currently trying to reconstruct/imitate a plot that I have seen in a paper. I have managed it quite well. However, I have three problems that I cannot get resolved. I hope that someone of you can help me.
So, the final plot should look something like this:
The code that I have used is :
plot(if_uebe$i.infitMSQ,type ="b", xlab = "Items der Skala UEBE", ylab = "Infit MSQ",
ylim = c(0.2, 1.8),
pch =ifelse((if_uebe$i.infitZ < 0| if_uebe$i.infitZ > 2), 1, 16))
abline(h= 1.0, col=c("black"), lty=5, lwd=1)
abline ( h = 1.3, col = "grey", lty=5, lwd=1)
abline ( h = 0.7, col = "grey", lty=5, lwd=1)
My first question is: How can I include two dependent variables instead of just one as it has been visualised in the plot from the paper (grey and black lines)?
The second aspect that I can't figure out is how to add customized x labels instead of 1,2,3 ... as it is the case with my plot. My X variable is unordered categorical, so customized labels such as "item 3", "item 10" on the x axis would make sense.
The third and last issue is that I want to use the ifelse() function concerning the point character. I want to make pch = 16 if they are smaller than -2 or greater than +2. Concerning the last condition (+2) there is no problem. The problem emerges when I want to include the negative number. Does someone of you know how to include the minus sign ( - ). I have tried it out with | -2 |
but it still does not work.
Any help would be highly appreciated. Thank you