Skip to content
Prev 17882 / 398502 Next

filled bars with patterns

Arne Mueller wrote:
Hi,

I'd also like to have the filled boxes in the legend to be striped. The
legend function has a 'density' attribute, but unfortunately this does't
seem to do anything

following the above example

legend(3.4, 5, c('Axx','Bxx','Cxx','Dxx'), fill = c('red', 'blue',
'green', 'orange'))

is the same as

 legend(3.4, 5, c('Axx','Bxx','Cxx','Dxx'), density=10, fill = c('red',
'blue', 'green', 'orange'),
      density=c(10,-1,20, 200))

In the above example R warns that 'border' is not used yet. Does that
change soon? Basically I'd like the border of each bar to be black
rather than the fill color.

However, isn't it a logic step to implement the density attribute of the
barplot in a way that one can mix filled bars with stiped bars? E.g

barplot(..., besides = FALSE, horiz = TRUE, col = c('red', 'blue',
'green', 'orange'),
	density = c(-1,0,-1,10))

where a density value of 0 means no density AND no filling (empty, just
border), a negative value means complete filling with no stipes and a
positve value means actually stiping with that density valie.

	regards,

	Arne
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._