[R] colored shading lines

Greg Snow Greg.Snow at intermountainmail.org
Mon Apr 23 17:48:33 CEST 2007


Here are a few options (others may have better ones):

1. Don't use shading lines.  These were mainly used when color/grayscale
was not available and are less needed now.  Also, sometimes the used of
shading lines causes a Moire vibration (the combination of the lines and
the physiology of the eye give the illusion of movement) which makes the
graph harder to read (see Tufte).

2. polygon (and friends) generally do either shading or color, but not
both.  When doing shading they use the color specified by par('fg'), so
you can set par(fg='red'), plot the polygon, then change the forground
color back to black (or whatever it was).  If you want the outline of
the polygon black, just plot another polygon (without density or color
arguments) over the top of the red one.

3. create your plot they way you do now (with the wrong color), then use
the plot2script function in the TeachingDemos package to get the low
level commands that were used to create the plot.  Find the segments
functions and change the color from red to black (you will also need to
remove the extra arguments from the box and polygon functions) then
rerun the entire created script.  This option is inferior to the 2 above
unless you want really detailed control of the final plot, or really
want to see the details that go into creating the plot.

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 stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of 
> Albrecht Kauffmann
> Sent: Monday, April 23, 2007 3:27 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] colored shading lines
> 
> Hi all,
> 
> it there any possibility to draw colored shading lines of a 
> polygon plot?
> E.g.
> 
> plot(polygon_object,col="red",density=10,angle=45)
> 
> produces only black shading lines within the polygon.
> 
> With many thanks for any hint
> 
> Albrecht
> 
> ______________________________________________
> 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.
>



More information about the R-help mailing list