[R] Fill a polygon with a pattern

Greg Snow Greg.Snow at intermountainmail.org
Tue Oct 9 00:14:23 CEST 2007


The simplest approach using just R is probably to create the background
by plotting the grid of your images, then draw with your background
color over everything outside the polygon that you want.

A possibly simpler approach is to draw the polygon in a solid color,
then use an outside program such as Imagemagick or gimp2 to replace the
polygon/color with your image.

This post: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/109468.html
may also give some ideas (similar question).

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.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 Alberto Monteiro
> Sent: Monday, October 08, 2007 3:42 PM
> To: r-help at r-project.org
> Subject: [R] Fill a polygon with a pattern
> 
> What is the simplest (namely: minimum number of libraries or 
> conflicts) way to fill a polygon with a pattern?
> 
> For example, suppose I have (in a graphic file, like a jpeg) 
> the drawing of an "X". Then I fill a polygon (like a 
> triangle) with this pattern, and get something like:
> 
>    X
>   XXX
>  XXXXX
> XXXXXXX
> 
> (where the border "X"s could be truncated).
> 
> I searched the rimage package, but it seems that there is no 
> such function.
> 
> Alberto Monteiro
> 
> ______________________________________________
> 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