[R] How to fill in a region with different patterns?

Greg Snow Greg.Snow at imail.org
Thu Feb 25 21:48:31 CET 2010


The rect function will draw a rectangle and can fill it with diagonal lines at specified angle and density.  But before you do that, really consider if and why you want to.  Using the diagonal lines became popular when the only way to get quality graphics was with a pen plotter (mechanical arm actually drawing the plot with a pen), filling an area was not reasonable (you could use a really high density of lines, but that usually made you unpopular with everyone else waiting for their turns, and often just wore a hole in your paper).

Research has shown (see Tufte's book) that patterns of lines are not the best approach, they can produce what is called the Moire effect which gives an illusion of color and movement.  These pattern fills are better at producing headaches and nausea and less effective at conveying information and producing useful plots.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of St.Jeff Shang
> Sent: Wednesday, February 24, 2010 8:34 PM
> To: r-help at r-project.org
> Subject: [R] How to fill in a region with different patterns?
> 
> Hi to all,
> 
> 
> 
> Here is a question which I cannot solve. Appreciate so much for any
> suggestions!
> 
> 
> 
> I have a squared region which is irregularly divided into many
> rectangular patches.
> 
> Each patch is associated with a value, and two patches possibly share a
> common value.
> 
> I hope to fill in each patch a pattern according to its value. For
> instance, if a patch has value 1, then I fill in that patch with
> pattern A; if it has value 2, then fill in it with pattern B,...
> 
> 
> 
> The pattern is something like a rectangular region with certain colored
> lines in it. For instance, pattern A may be a white rectangular region
> filled in by two thick black lines;
> 
> pattern B may be a white rectagular region filled in by 10 thick black
> lines,...
> 
> 
> 
> Is this available in matlab? I have serached "polygnon" in matlab user
> guide and found a
> 
> "fill function" may work, however, there is still a long way to finally
> complete it.
> 
> 
> 
> Many thanks again!
> 
> Jeff
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.



More information about the R-help mailing list