Filling bars with lines/grids/points is legacy back to the days when the only way to get high quality plots was to use a pen plotter (on the screen you would see bars made of '*' or similar).  The pen plotter would use a mechanical arm to draw the lines using a pen/marker.  it was easy to have the pen draw lines in a rectangle, but filling the rectangle with color just meant drawing the lines so close together that there was not space between them (and getting everyone else mad at you because it took so long, used up all the ink, and usually made holes in your paper).
 
With modern graphics devices, filling the rectangle with a solid color is simpler than the lines.
 
Using lines/grids can also lead to various optical illusions of colors or movement (called a Moire effect), see Tufte's book on displaying quantitative information for some detail on this.
 
Some patterns can also make some bars appear longer or shorter (the gradient patterns that are popular in some areas).
 
Using shading lines, patterns should be used carefully because of this (it is best to do a simple graph to compare to your more fancy version to compare and see if there are any visual distortions due to fills).
 
If you really want to try the different fills, there are a couple of options. 
 
You can create the barplot with a unique color as the fill and save this to a graphics file.  Then create (or find) the fill you want  and save that to a graphics file.  Use an external graphics manipulation program such as Imagemagick or gimp2 to then replace the bar fills with the pattern.
 
If you want a pure R solution then you can do something like this (replace tmpfun with any function that adds the fill pattern of interest to an existing plot):
 
library(TeachingDemos)
tmp.dat <- table( sample( letters[1:4], 1000, replace=TRUE) )
tmp1 <- barplot(tmp.dat, col=NA, width=1, ylim=c(-5,max(tmp.dat)+5))
tmp2 <- par('usr')
tmpfun <- function(){
 tmp.x <- seq(tmp2[1], tmp2[2], length=50)
 tmp.y <- seq(tmp2[3], tmp2[4], length=50)
 points( expand.grid(x=tmp.x, y=tmp.y), pch='.' )
}
for (i in seq(along=tmp1) ){
 clipplot( tmpfun(), xlim=tmp1[i] + c(-0.5,0.5), ylim=c(0,tmp.dat[i]) )
}
 
Again, always compare such plots to one without fill (or solid fill), to make sure that you are not distorting/distracting/etc.
 
Hope this helps,
 

 
 
________________________________

From: r-help-bounces@r-project.org on behalf of yaosheng CHEN
Sent: Mon 1/28/2008 8:08 AM
To: Domenico Vistocco
Cc: r-help@r-project.org
Subject: Re: [R] How to fill bar plot with textile rather than color



Thank you, and also thanks to John Kane.

I did some tests last night, if you plot something like

height <- t(t(c(1,-1,1)))
bardensity <- t(t(c(10,10,0)))
barangle <- t(t(c(45,135,0)))
barplot(height, density = bardensity, angle = barangle)

You can get grids. Otherwise, only slanted lines or colors.
I thought filling with dots or grids is quite common in traditional bar chart.
But most softwares, including Matlab, SAS, Excel2k7, and gunplot, as I
know, don't have such options.
Anyway, thank you again. Let me know if you find any package which can
fill bar plot with dots

On Jan 28, 2008 4:13 AM, Domenico Vistocco <vistocco@unicas.it> wrote:
> If you type
>
>  > example(barplot)
>
> you will find an example.
>
> Ciao,
> domenico
>
> CHENYS wrote:
> > Hi, I'm looking for a tool which can fill bar chart with dash, skewed line,
> > or grids, rather than pure color. Any one have the idea how to do that in R?
> > Or maybe in Matlab will also be helpful.
> >
> > Thanks very much.
> >
>
>

______________________________________________
R-help@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.



	[[alternative HTML version deleted]]

