Re: [R] legend position in "barplot"

From: Uwe Ligges <ligges_at_statistik.tu-dortmund.de>
Date: Sun, 20 Mar 2011 19:31:55 +0100

On 20.03.2011 18:52, Hongwei Dong wrote:
> Hi, R users,
>
> I there a way that I can control the position of the legend while using
> "barplot" function?
>
> For example:
>
> a<-matrix(c(0,0,0.5,0.8,0.9,0.9),2,3)
> colnames(a)<-c("X","Y","Z")
> rownames(a)<-c("A","B")
> a
> barplot(a,width = 0.2,legend =
> TRUE,axes=FALSE,col=c("coral3","steelblue3"),beside=TRUE)
>
> In this case, the legend is too small, and I want to move it to the left.
> Thanks.

Yes, e.g.:

barplot(a, width = 0.2, legend = TRUE, axes = FALSE,

         col = c("coral3", "steelblue3"), beside = TRUE,
         args.legend = list(x="topleft"))

Uwe Ligges

>
> Regards
> Gary
>
> [[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.



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. Received on Sun 20 Mar 2011 - 18:38:34 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 20 Mar 2011 - 18:40:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive