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

From: Karl Ove Hufthammer <Karl.Hufthammer_at_math.uib.no>
Date: Tue, 22 Apr 2008 16:22:55 +0200


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.
Received on Tue 22 Apr 2008 - 14:26:10 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 22 Apr 2008 - 19:30:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive