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

Yihui Xie xie at yihui.name
Tue Oct 22 17:14:48 CEST 2013

Thanks for the hints! I was originally wondering the difference
between grDevices::png(type='cairo') and Cairo::CairoPNG() for the
case pch=16, a solid point without border. Cairo does a nice job for
such point symbols, but png() renders them very poorly.

Yihui Xie <xieyihui at gmail.com>
Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA

On Tue, Oct 22, 2013 at 9:09 AM, Simon Urbanek
<simon.urbanek at r-project.org> wrote:
> The Cairo package does "smart" anti-aliasing - it aligns lines that are perpendicular to the axes such that they centered at pixels. That avoids the anti-aliasing effects that Brian was talking about for the heatmap example. This enables Cairo to have full anti-aliasing support and still render heatmaps without artifacts.
> However, there is no way around the anti-aliasing artifacts if you use arbitrary polygons without borders. For example:
> library(deldir)
> plot(c(-1,1),c(-1,1),ty='n')
> for(p in tile.list(deldir(rnorm(200),rnorm(200)))) polygon(p$x,p$y,col=heat.colors(15)[runif(1,1,15)], border=NA)
> That said, in our experience the Cairo approach works very well in practice.
> Cheers,
> Simon

More information about the R-devel mailing list