If length(col)<length(legend.txt) in barplot, then the reversal of the legend leads to funny results. For example: x <- matrix(runif(25),nrow=5) barplot(x,col=c("red","green","black"),legend=as.character(1:5),ylim=c(0,5)) The (easy) fix is to replace legend.col <- col with legend.col <- rep(col,length=length(legend.text)) on line 94 of barplot.default. Trivia, but hey, it confused me for a little while, it might as well be fixed. --please do not edit the information below-- Version: platform = i686-unknown-linux arch = i686 os = linux system = i686, linux status = major = 1 minor = 0.0 year = 2000 month = February day = 29 language = R Search Path: .GlobalEnv, Autoloads, package:base -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel 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-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
maechler@stat.math.ethz.ch
2000-Mar-22 10:40 UTC
[Rd] minor problem in barplot legend (PR#494)
>>>>> "Ben" == Ben Bolker <bolker@zoo.ufl.edu> writes:Ben> If length(col)<length(legend.txt) in barplot, then the reversal of Ben> the legend leads to funny results. For example: Ben> x <- matrix(runif(25),nrow=5) Ben> barplot(x,col=c("red","green","black"),legend=as.character(1:5),ylim=c(0,5)) Ben> The (easy) fix is to replace Ben> legend.col <- col Ben> with Ben> legend.col <- rep(col,length=length(legend.text)) Ben> on line 94 of barplot.default. Ben> Trivia, but hey, it confused me for a little while, it might as well Ben> be fixed. Now done for "R-release", i.e. the (unreleased) future R 1.0.1 Thank you, Ben! Martin -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel 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-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._