On 20/10/2012 10:33, Jim Lemon wrote:
On 10/20/2012 06:22 AM, Yakamu Yakamu wrote:
Dear all,
I would like to make 6 barplots in one page but with a legend that
applies to all the barplots and would like to put it in the
central-bottom of the page.
I know only how to make legend for individual barplot, but since all
my barplots have the same type and would be better if i just use one
legend for all of them, and i cannot seem to find a way to put the
legend in the bottom and centered.
Please advice...
I set the margins (and font type) as follows :
par(mfrow=c(3,2),pty="m") # Layout with 3x2 plots
par(oma=c(3,4,3,4)) # Outer margins
par(mar=c(5,5,2,2)) # Inner margins
par(xpd=F)
par(family="serif", font=1) # Times New Roman font
Hi Yayu,
First, leave enough space below your plots, then:
# allow the legend to display outside the plots
par(xpd=TRUE)
# work out where you want the legend in the user coordinates
# of the _last_ plot displayed
legend(x,y,...)
par(xpd=FALSE)
It is clearer and safer to use
legend(x,y, ..., xpd = TRUE)
See the help page.
Jim
______________________________________________
R-help@r-project.org mailing list
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.
--
Brian D. Ripley, rip...@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
______________________________________________
R-help@r-project.org mailing list
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.