[R] Getting rid of borders on semi-transparent plotting symbols

hadley wickham h.wickham at gmail.com
Tue Apr 22 18:13:48 CEST 2008


But is this behaviour a bug or by design?
Hadley

On Tue, Apr 22, 2008 at 10:47 AM, Prof Brian Ripley
<ripley at stats.ox.ac.uk> wrote:
> plot(0, 0, pch=21, bg="#FF000022", col="#FF000001")
>
>  may be (close to) what you are looking for.
>
>
>
>  On Tue, 22 Apr 2008, Karl Ove Hufthammer wrote:
>
>  > R version 2.7.0 RC (2008-04-20 r45403)
>  >
>  > When using semi-transparent filled plotting symbols, the border of the
>  > symbol has a different (darker) colour than the interior:
>  >
>  > plot(0, 0, pch=19, col="#FF000022")
>  >
>  > (Saving this as a PDF and looking at it magnified may make it easier to
>  > see.)
>  >
>  > This is pretty annoying, since when plotting partially overlapping
>  > points, the border colour dominates, making the colour of overlapping
>  > points more saturated than they should be.
>  >
>  > This isn't so much of a problem when using very large values of 'cex',
>  > since the width of the border is constant, and doesn't vary with cex.
>  > But with small values (and the default value) of cex, it's very visible.
>  >
>  > I thought this maybe could be solved by using pch=21 instead of pch=19,
>  > and setting the 'bg' colour to the same colour as 'col', like this.
>  >
>  > plot(0, 0, pch=21, col="#FF000022", bg="#FF000022")
>  >
>  > But this has no effect. 'bg' *does* set the background (interior) colour
>  > (this is easy to check by using a different colour), but not the border
>  > colour, which is determined by 'col' alone.
>  >
>  > So I guess in theory I can get the border and interior the same colour by
>  > setting 'col' to a ligher colour than the one I actually want to use,
>  > and then set the 'bg' colour to the one I want to use. But how should I
>  > select the lighter colour so that the darker version (i.e., the border
>  > colour) is the one I want?
>  >
>  > Frankly, the current behaviour feels much more like a bug than a feature.
>  > If I set pch=19, I want a completely filled circle, even if my chosen
>  > colour is partially transparent.
>  >
>  > I'm using
>  > R version 2.7.0 RC (2008-04-20 r45403)
>  > i686-pc-linux-gnu
>  >
>  > --
>  > Karl Ove Hufthammer
>  >
>  > ______________________________________________
>  > 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.
>  >
>
>  --
>  Brian D. Ripley,                  ripley at stats.ox.ac.uk
>  Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
>  University of Oxford,             Tel:  +44 1865 272861 (self)
>  1 South Parks Road,                     +44 1865 272866 (PA)
>  Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>
>
>
>  ______________________________________________
>  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.
>



-- 
http://had.co.nz/



More information about the R-help mailing list