[R] ggplot2-caption on graphics

Felipe Carrillo mazatlanmexico at yahoo.com
Thu Oct 29 22:17:25 CET 2009


Hi:
I am trying to add some caption at the bottom of the graphic by using the 'xlab' and just adding a new line to it. Is there another way to do this or this is the correct way? Thanks

library(ggplot2)
library(effects)

df <- data.frame(
  x = c(3, 1, 5),
  y = c(2, 4, 6),
  label = c("a","b","c")
)
p <- ggplot(df, aes(x, y, label = label)) +
  xlab("X label\n\nThis graphic needs some caption here.\nIs there another way to add caption to graphics?") + ylab(NULL)
p + geom_point() + opts(title = "geom_point")


Felipe D. Carrillo  
Supervisory Fishery Biologist  
Department of the Interior  
US Fish & Wildlife Service  
California, USA




More information about the R-help mailing list