Yihui Xie
2013-Oct-21 21:43 UTC
[Rd] png(type='cairo'): point symbols without boarders are not anti-aliased?
Hi, It seems that anti-aliasing in png(type = 'cairo') is not well supported for the point symbols without boarders, e.g. pch = 16. The Cairo package works well, though. You can compare png() with CairoPNG(): png(): http://i.imgur.com/8niB3jX.png CairoPNG(): http://i.imgur.com/FZBJOxm.png f = function(dev, ..., main = '') { dev(...) plot(c(1, 2, 1, 2), c(1, 1, 2, 2), pch=c(16, 19), cex=c(2, 2, 15, 15), xlim=c(0.5, 2.5), ylim=c(0.5, 3), main = deparse(substitute(dev))) dev.off() } f(grDevices::png, 'png-base.png', type = 'cairo') f(Cairo::CairoPNG, 'png-Cairo.png') If I remove the border for pch=19 (i.e. lwd=0), the point shows rough edges as well. I'm not sure if that is expected, or it is due to my misconfiguration somewhere. I installed R via `apt-get install r-base-dev` under Ubuntu using the CRAN repository.> sessionInfo()R version 3.0.2 (2013-09-25) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] Cairo_1.5-2 tools_3.0.2> capabilities()jpeg png tiff tcltk X11 aqua http/ftp sockets TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE libxml fifo cledit iconv NLS profmem cairo TRUE TRUE TRUE TRUE TRUE TRUE TRUE Regards, Yihui -- Yihui Xie <xieyihui at gmail.com> Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA
Yihui Xie
2013-Oct-21 21:44 UTC
[Rd] png(type='cairo'): point symbols without boarders are not anti-aliased?
Sorry, typo in the subject: I mean "borders". Regards, Yihui -- Yihui Xie <xieyihui at gmail.com> Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Mon, Oct 21, 2013 at 4:43 PM, Yihui Xie <xie at yihui.name> wrote:> Hi, > > It seems that anti-aliasing in png(type = 'cairo') is not well > supported for the point symbols without boarders, e.g. pch = 16. The > Cairo package works well, though. You can compare png() with > CairoPNG(): > > png(): http://i.imgur.com/8niB3jX.png > CairoPNG(): http://i.imgur.com/FZBJOxm.png > > f = function(dev, ..., main = '') { > dev(...) > plot(c(1, 2, 1, 2), c(1, 1, 2, 2), pch=c(16, 19), cex=c(2, 2, 15, 15), > xlim=c(0.5, 2.5), ylim=c(0.5, 3), main = deparse(substitute(dev))) > dev.off() > } > f(grDevices::png, 'png-base.png', type = 'cairo') > f(Cairo::CairoPNG, 'png-Cairo.png') > > If I remove the border for pch=19 (i.e. lwd=0), the point shows rough > edges as well. > > I'm not sure if that is expected, or it is due to my misconfiguration > somewhere. I installed R via `apt-get install r-base-dev` under Ubuntu > using the CRAN repository. > >> sessionInfo() > R version 3.0.2 (2013-09-25) > Platform: x86_64-pc-linux-gnu (64-bit) > > locale: > [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C > LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 > [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 > LC_PAPER=en_US.UTF-8 LC_NAME=C > [9] LC_ADDRESS=C LC_TELEPHONE=C > LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > loaded via a namespace (and not attached): > [1] Cairo_1.5-2 tools_3.0.2 > >> capabilities() > jpeg png tiff tcltk X11 aqua http/ftp sockets > TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE > libxml fifo cledit iconv NLS profmem cairo > TRUE TRUE TRUE TRUE TRUE TRUE TRUE > > > Regards, > Yihui > -- > Yihui Xie <xieyihui at gmail.com> > Web: http://yihui.name > Department of Statistics, Iowa State University > 2215 Snedecor Hall, Ames, IA
Paul Murrell
2013-Oct-21 22:28 UTC
[Rd] png(type='cairo'): point symbols without boarders are not anti-aliased?
Hi Is this the same as "Bug 15462" ? https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=15462 Paul On 10/22/13 10:43, Yihui Xie wrote:> Hi, > > It seems that anti-aliasing in png(type = 'cairo') is not well > supported for the point symbols without boarders, e.g. pch = 16. The > Cairo package works well, though. You can compare png() with > CairoPNG(): > > png(): http://i.imgur.com/8niB3jX.png > CairoPNG(): http://i.imgur.com/FZBJOxm.png > > f = function(dev, ..., main = '') { > dev(...) > plot(c(1, 2, 1, 2), c(1, 1, 2, 2), pch=c(16, 19), cex=c(2, 2, 15, 15), > xlim=c(0.5, 2.5), ylim=c(0.5, 3), main = deparse(substitute(dev))) > dev.off() > } > f(grDevices::png, 'png-base.png', type = 'cairo') > f(Cairo::CairoPNG, 'png-Cairo.png') > > If I remove the border for pch=19 (i.e. lwd=0), the point shows rough > edges as well. > > I'm not sure if that is expected, or it is due to my misconfiguration > somewhere. I installed R via `apt-get install r-base-dev` under Ubuntu > using the CRAN repository. > >> sessionInfo() > R version 3.0.2 (2013-09-25) > Platform: x86_64-pc-linux-gnu (64-bit) > > locale: > [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C > LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 > [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 > LC_PAPER=en_US.UTF-8 LC_NAME=C > [9] LC_ADDRESS=C LC_TELEPHONE=C > LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > loaded via a namespace (and not attached): > [1] Cairo_1.5-2 tools_3.0.2 > >> capabilities() > jpeg png tiff tcltk X11 aqua http/ftp sockets > TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE > libxml fifo cledit iconv NLS profmem cairo > TRUE TRUE TRUE TRUE TRUE TRUE TRUE > > > Regards, > Yihui > -- > Yihui Xie <xieyihui at gmail.com> > Web: http://yihui.name > Department of Statistics, Iowa State University > 2215 Snedecor Hall, Ames, IA > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 paul at stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/