With this code:
library(ggplot2) p <- ggplot(mtcars, aes(wt, mpg)) p + geom_point() p + geom_point() + geom_text(aes(wt, mpg, label=row.names(mtcars))) >
You could just get an extra variable:
carnames <- row.names(mtcars) carnames[with(mtcars, !(wt > 4 | mpg > 25))] <- "" p + geom_point() + geom_text(aes(wt,mpg,label=carnames))