Place the aesthetic mapping under ggplot
instead of geom_point
to avoid the warning:
## This produces an "unknown aesthetic" warning
ggplot( mtcars, aes( x = wt, y = mpg ) ) + geom_point( aes( text = cyl ) )
## This doesn't
ggplot( mtcars, aes( x = wt, y = mpg, text = cyl ) ) + geom_point()