Dear R-Helpers

I am attempting to get a legend in the outer margins of a graph that has a
similar flexibility to mtext(), within base graphics.  This is used in a
tool that will end up with graphs of many different coordinates, exported
in many different sizes.  I'm trying to come up with a general solution.
I've used "bottom right" before but I found it interferes with the graphs
frequently.

Here was my best attempt at something general, but then I encountered the
graph re-sizing issue:

x <- 1:100
y <- x +rnorm(100, 0,10)
plot(x,y, xlab="", main="Shrink and Enlarge This Graph")
abline(0,1 ,lty=2)

legend(x=grconvertX(1, from = "ndc", to = "user"),
       y=grconvertY(0, from = "ndc", to = "user"),
       lty=2,
       legend="The legend doesn't rescale nicely",
       xjust=1, yjust=0,
       bty="n",
       xpd=TRUE)

mtext("This example has some text in the outer margin.\nIt rescales
nicely.",
      side = 1, line=3.5, adj=0)


Thanks!
Peter

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
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