Until now I was using plot() and I check the possibility to shift to ggplot2.

All is OK until now except to write text out of the plotting region [equivalent of par(xpd=TRUE); text(x, y, labels)].

I have found using google recommendation to use annotation_custom() but I still failed to print text out of the plotting region:


df <- data.frame(x = 1:10, y = 1:10)
ggplot(data=df, mapping=aes(x, y))+
  geom_line(color="black") +
  grob = textGrob(label="essai"), xmin=2.5, xmax=5, ymin=10, ymax=11
) + theme(plot.margin = unit(c(1.5, 1, 0.5, 0.5), "cm"))

If someone has the solution, I could continue to explore ggplot2 !

Thanks a lot,


R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to