[R] barplot: legend: two rows

Uwe Ligges ligges at statistik.tu-dortmund.de
Wed May 9 17:04:24 CEST 2012



On 09.05.2012 13:23, Marion Wenty wrote:
> dear r-helpers,
>
> i have got another question:
>
> i am using the functions
>
> par(xpd=T)
> legend
>
> to create a legend below the x-axis. i used the parameter horiz=T.
>
> now i would like to put the elements of the legend in two rows:
>
> e.g. if my legend has got 5 elements, i would like 3 elements in one row
> and the last two elements in the next row.
>
> does anyone know how to do that?

Example:

bp <- barplot(1)
par(xpd = TRUE)
legend(bp, 0, xjust=0.5, legend=letters[1:5], lwd=1:5, ncol=3)

Uwe Ligges


> thank you very much for your help in advance!
>
> marion
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list