R graph irregular time interval on x axis

#1
Hi,

I'm trying to plot an irregular time interval. I'm attaching the plot i'm dealing with. I want to keep some space on the x-axis between year 0 and year 2 (for year 1) and smooth the curve between the two time points.

This is the syntax i'm using now:
interaction.plot(meanbetasPm$X1[meanbetasPm$X3=="Low"], meanbetasPm$X2[meanbetasPm$X3=="Low"],
meanbetasPm$meanbetasPm.outmP.imp1.beta[meanbetasPm$X3=="Low"],
main="Low achievers",
xlab="Year", ylab="Peer relations", cex.axis=0.8, cex.lab=0.8, legend=F, ylim=c(3,6))
legend("bottomright", c("noR", "K3R", "G1R"), lty=c(1,2,3), cex=0.8)

Does someone has an idea how to do this?

Thank you so much!

Best,
Machteld
 

Jake

Cookie Scientist
#2
I believe you can add an NA value between Y0 and Y2 in the data vectors and this should do what you want. At least, this works for plot(..., type="l"), not sure about interaction.plot()