[R] legend with density and fill

Andrew Robinson A.Robinson at ms.unimelb.edu.au
Sat Mar 17 20:48:58 CET 2007


Hi Simon,

Try

fill=c("white","dark grey","black","black"), density=c(NA,NA,25,75), 

etc

Cheers

Andrew

On Sat, Mar 17, 2007 at 12:36:19PM +0000, Simon Pickett wrote:
> Hi,
> 
> I am trying to make a legend with four symbols as follows
> 
> 1.white box
> 2.black box
> 3.clear box (same as background)
> 4.clear box with shading lines
> 
> but the shading lines arent showing...
> 
> here is my code.
> 
> par(bg="lightyellow")
> barplot(c(seq(1,6,1)))
> legend(8.5,0.3, bty="o", legend=c("young","old","male","female"),
> col="black",cex=1.5,
> fill=c("white","dark grey",0,0),density=c(NA,NA,0,100),angle=45)
> 
> any suggestions much appreciated,
> Thanks, Simon.
> 
> 
> 
> Simon Pickett
> PhD student
> Centre For Ecology and Conservation
> Tremough Campus
> University of Exeter in Cornwall
> TR109EZ
> Tel 01326371852
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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.

-- 
Andrew Robinson  
Department of Mathematics and Statistics            Tel: +61-3-8344-9763
University of Melbourne, VIC 3010 Australia         Fax: +61-3-8344-4599
http://www.ms.unimelb.edu.au/~andrewpr
http://blogs.mbs.edu/fishing-in-the-bay/



More information about the R-help mailing list