[R] Rotate legends or other approaches to nice legend placement?

From: Alex Brown <alex_at_transitive.com>
Date: Mon 04 Jul 2005 - 20:19:16 EST


I'm sure this general sort of question has been asked many times before
- I would _like_ automatic and sensible legend placement in barplots so
data is not overwritten... but since there doesn't seem to be one, one of the following would be useful:

One approach for this would be to place the legend to the right of the graph, and rotate it by 90 degrees.

Is there a sensible way to do this?

alternatively, is there a function to

  1. estimate legend size
  2. adjust nrows so that the full width of the drawing device is used, minimising height
  3. use layout() so that enough space is allocated beneath the graph for the legend
  4. draw legend
  5. allow user to call plot, correctly drawing the plot in the remaining frame?

I have taken a look at this, but I am confused by the different units used by par(mar), legend(plot=F), and layout.

-Alex Brown



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Jul 04 20:24:36 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:11 EST