[R] Legend placement in barplots
david.whiting@ncl.ac.uk
david.whiting at ncl.ac.uk
Mon Jan 7 20:19:19 CET 2002
Hi,
I am trying to use R to create some reasonably automatic output for
routine monitoring. Some of these outputs are simple bar charts. I need to
create something similar to an excel bar chart (yuk!, I know...:) which
places the legend at the bottom of the chart.
barplot() place the legend over the chart and can potentially cover some
of the detail (especially if the bars are numerous and thin). legend()
allows me to position the legend but, as the example below shows, still
only within the chart area. How can I place the legend below or to the
right of a bar plot? Do I need to use plot.new() and build it up myself?
Example:
--------
barplot(1:3, legend.text = c("cats", "dogs", "cows"))
legend(1,0.5, c("cats", "dogs", "cows"))
legend(1,0.1, c("cats", "dogs", "cows"))
Thanks,
Dave.
--
David Whiting
Adult Morbidity and Mortality Project (AMMP)
PO Box 65243
Aga Khan Foundation Building - Ground Floor
Plot No 344 Urambo Street
Upanga
Dar es Salaam
Tanzania
Tel: +255 22 2153388
Fax: +255 22 2153385
Email: david.whiting at ncl.ac.uk
AMMP website: www.ncl.ac.uk/ammp
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list