I have a graph built like this
library(ggplot2) x <- sort(rnorm(1000)) y <- rnorm(1000) z <- rnorm(1000) + atan2(x, y) dt <- data.frame(x, y, z) g <- ggplot(dt, aes(x = x, y = y)) g <- g + geom_point(aes(color = z)) + scale_color_gradient(low="blue", high="red") plot(g) I want to add a table with a little statistics over the graph: total points, points with a value of z < -1 , points with values of -1 <= z <= 1 , points with a value of z > 1 . I tried to add a table through annotation_custom() , but it turns out too crooked. Maybe there are some other ways to add a table above the graph?
