[R] Color of box frame in Legend (Was: Matrix barplot)

From: Andreas Tille <tillea_at_rki.de>
Date: Sat, 26 Jul 2008 09:55:07 +0200 (CEST)

On Fri, 25 Jul 2008, Nutter, Benjamin wrote:

>> data <- data.frame(Year=c(2000,2001,2002),

After the great help here I have a final problem (bug in R??) with the background color. I would like to put my final drawing on a dark background and thus I would like to use brigt colors for axes etc. This works perfectly with the following script except for the frame around the color bars in the legend. Just give this a try:

data <- data.frame(Year=c(2000,2001,2002),
                      A=c(2,2,1),
                      B=c(3,1,2),
                      C=c(0,3,5))

data.mat <- as.matrix(data)[,2:4]
rownames(data.mat) <- data[['Year']]
data.mat <- t(data.mat)

textcolor="yellow"
pdf("testdata.pdf", fg=textcolor)
par(col.axis=textcolor,col.main=textcolor)

barplot(data.mat,beside=TRUE,col=rainbow(3),main="Test") legend(x="topleft", colnames(data[,2:4]),fill=rainbow(3), inset=0.05,

        text.col=textcolor
       )


You will notice that the frame around the color bars in the legend remains black even if I expect it to be yellow. Did I missed something or is this a bug in the legend drawing routine?

Kind regards

         Andreas.

-- 
http://fam-tille.de

______________________________________________
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 Sat 26 Jul 2008 - 07:59:37 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 Sat 26 Jul 2008 - 08:32:30 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