[Rd] png(type='cairo'): point symbols without boarders are not anti-aliased?

Yihui Xie xie at yihui.name
Mon Oct 21 23:43:08 CEST 2013


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



More information about the R-devel mailing list