From 01f4e080df18bb083acae7fcd2f67e19858940fb Mon Sep 17 00:00:00 2001 From: Winston Chang Date: Tue, 9 Apr 2013 15:57:18 -0500 Subject: [PATCH] Workaround for Cairo resolution bug --- R/imageutils.R | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/R/imageutils.R b/R/imageutils.R index 55e715c9a..2803bd879 100644 --- a/R/imageutils.R +++ b/R/imageutils.R @@ -32,7 +32,14 @@ plotPNG <- function(func, filename=tempfile(fileext='.png'), pngfun <- png } else if (nchar(system.file(package = "Cairo"))) { require(Cairo) - pngfun <- CairoPNG + + # Workaround for issue #140: Cairo ignores res and dpi settings. Need to + # use regular png function. + if (res == 72) { + pngfun <- CairoPNG + } else { + pngfun <- png + } } else { pngfun <- png }