# NOT RUN {
p <- ggplot(iris, aes(Sepal.Width, Sepal.Length, colour = Species))
# Labelling group midpoints
p + geom_point() +
  stat_midpoint(aes(label = Species, group = Species),
                geom = "text", colour = "black")
# Drawing segments to centroids
p + geom_point() +
  stat_centroid(aes(xend = Sepal.Width, yend = Sepal.Length),
                geom = "segment", crop_other = FALSE)
# Drawing intervals
ggplot(iris, aes(Sepal.Width, Sepal.Length, colour = Species)) +
  geom_point() +
  stat_funxy(geom = "path",
             funx = median, funy = quantile,
             argy = list(probs = c(0.1, 0.9)))
# }
Run the code above in your browser using DataLab