I create a figure containing two plots using a function i.e.
data1<-1:3
basic<-function(data1){
par(mfrow=c(2,1))
plot(data1)
plot(data1)
}
basic(data1)
Now I want to add text to the plots without having to include it in the function. But I can only add text to the bottom plot (see below).
text(x=c(1.5,1.6,1.7),y=c(2,2.1,2.2), labels=c("X","Y","Z"))

How can I add text to the top plot outside of the function? (I have lots of figures I create using the same function but need to place slightly different text labels in slightly different positions on each one). Thanks for any advice.
You could outline what the different texts are first e.g.
then put them in your function
As @Andrie says calling plot means any further
text()calls will work on the last plot only