[R] Annoying bug (?) in package cairoDevice

From: Josh Gilbert <jgilbert.r_at_gmail.com>
Date: Tue, 29 Apr 2008 16:26:39 -0400


I apologize for sending this twice, I didn't realize that gmail helpfully defaulted to rich formatting.

For some reason, Cairo_png puts a box around a figure when you call plot.new. It looks like box was called with black and a transparent background. Example:
> library(cairoDevice)
> Cairo_png('cairo.png')
> plot.new()
> dev.off()
null device

          1

The boarder is narrow, so it's hard to see with a stand-alone image viewer. If you paste the png onto a white background it's quite clear.

Admittedly, the default for par("bg") is transparent, par("bty") is "o" and par("col") is black. However, this behavior is not consistent with other devices (such as png in grDevices even if I set par(bg="white")). Also, Cairo_png draws the box even when par(bty="n").

I just tested this on Debian with version 2.6 of cairoDevice. I've also observed this behavior on Windows and it's not a new problem.

The only workaround I've found is to call
> Cairo_png()
> par(col="white")
> setHook("plot.new", function() par(col="black"))
> plot(...)

As far as I'm concerned, this is a serious bug, it's a real problem when creating figures for publication. I'd like confirmation that this is, in fact, a bug as I haven't seen much documentation for standards for devices. I suspect that it's a shallow bug, but I've never seen the code for plot.new nor do_Cairo so my suspicion may be more hope than insight.

Josh Gilbert

Statistical Researcher
Broad Institute
Chemical Biology Program



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 29 Apr 2008 - 20:35:39 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 Apr 2008 - 21:30:39 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive