Henric Nilsson (Public)
2007-Sep-15 13:33 UTC
[Rd] R-2.6.0 for Windows, semi-transparent colours and layout()
Hi, The added support for semi-transparent colours in `windows' under R-2.6.0 for Windows is much appreciated. However, I've discovered that issuing a `layout' (or `par' with arguments `mfcol'/`mfrow') call and then trying to plot several figures with semi-transparent colour on the same page results in only the first one being fully drawn. E.g. > x <- rnorm(10000) > y <- rnorm(10000) > > layout(matrix(1:2, ncol = 2)) > plot(y ~ x, pch = 16, col = rgb(1, 0, 0, 0.15)) > plot(y ~ x, pch = 16, col = rgb(1, 0, 0, 0.15)) results in the second one having only the axes and box, but no data points. This is under > sessionInfo() R version 2.6.0 alpha (2007-09-14 r42843) i386-pc-mingw32 locale: LC_COLLATE=Swedish_Sweden.1252;LC_CTYPE=Swedish_Sweden.1252;LC_MONETARY=Swedish_Sweden.1252;LC_NUMERIC=C;LC_TIME=Swedish_Sweden.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base Henric
Prof Brian Ripley
2007-Sep-17 14:43 UTC
[Rd] R-2.6.0 for Windows, semi-transparent colours and layout()
On Sat, 15 Sep 2007, Henric Nilsson (Public) wrote:> Hi, > > The added support for semi-transparent colours in `windows' under > R-2.6.0 for Windows is much appreciated. > > However, I've discovered that issuing a `layout' (or `par' with > arguments `mfcol'/`mfrow') call and then trying to plot several figures > with semi-transparent colour on the same page results in only the first > one being fully drawn. E.g.That's not the whole story, as my test examples using multiple subplots did work. The problem I found is that clipping rectangles were being used in some places where I cannot find documentation that they should be. So explicitly setting the clipping rectangle before each alpha-blending call seems to fix the problematic examples, including yours.> > > x <- rnorm(10000) > > y <- rnorm(10000) > > > > layout(matrix(1:2, ncol = 2)) > > plot(y ~ x, pch = 16, col = rgb(1, 0, 0, 0.15)) > > plot(y ~ x, pch = 16, col = rgb(1, 0, 0, 0.15)) > > results in the second one having only the axes and box, but no data > points. This is under > > > sessionInfo() > R version 2.6.0 alpha (2007-09-14 r42843) > i386-pc-mingw32 > > locale: > LC_COLLATE=Swedish_Sweden.1252;LC_CTYPE=Swedish_Sweden.1252;LC_MONETARY=Swedish_Sweden.1252;LC_NUMERIC=C;LC_TIME=Swedish_Sweden.1252 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > > Henric > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- 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