Re: [R] How to fill in a region with different patterns?
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.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of St.Jeff Shang Sent: Wednesday, February 24, 2010 8:34 PM To: r-help@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@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. __ 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.
Re: [R] How to fill in a region with different patterns?
Hi, If you are curious you might like to try a highly experimental Grid function I wrote some time ago, library(grid) source(http://gridextra.googlecode.com/svn/trunk/R/patternGrob.r;) grid.newpage() grid.pattern(x=seq(1/6, 5/6, length=6), width=unit(1/8,npc), height=unit(0.5,npc), motif.width=unit(10, mm), pattern=c(1:6), orientation=45, motif.alpha=0.5, motif.cex=c(1, 0.5), motif.col=1:2, motif.fill=NA, gp=gpar(fill=blue, lwd=2, alpha=0.5), clip=T) If you really insist on using shading patterns despite Greg's sound advice, it might give you some inspiration. HTH, baptiste On 25 February 2010 04:34, St.Jeff Shang mathsh...@yahoo.com wrote: 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@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. -- Baptiste Auguié Departamento de Química Física, Universidade de Vigo, Campus Universitario, 36310, Vigo, Spain tel: +34 9868 18617 http://webs.uvigo.es/coloides __ 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.
[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@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.