Reputation: 952
I'm creating a plot made up of smaller subplots using mfrow in par(), similarly to examples here.
Is there a way to add labels (A, B, C, ...) programmatically in the top corner of each of the subplots? Something like the letters in this plot.
Upvotes: 2
Views: 1069
Reputation: 37641
Yes. You can add text to the margin using the mtext
function.
par(mfrow=c(2,2))
for(i in 2:5) {
plot(mtcars[,c(1,i)], pch=20)
mtext(LETTERS[i-1], adj=0, line=1)
}
Upvotes: 4