Weigand, Stephen D.
2008-Jun-16 21:16 UTC
[Rd] tiff(), jpeg(), and png() in R 2.7.0: problems if 'units = "in"' but default height and width
I love the new tiff(), jpeg(), and png() in R 2.7.0 but found an issue that I didn't see reported. When specifying 'units = "in"' but forgetting to change the default height and width (so the figure is unintentionally going to be 480 inches by 480 inches) I run into problems. Here's the reproducible example: tiff("a.tiff", units = "in", res = 1200, compression = "lzw") hist(rnorm(10)) dev.off() Before dev.off(), I get these warnings: Warning messages: 1: In title(main = main, sub = sub, xlab = xlab, ylab = ylab, ... : X11 protocol error: BadAlloc (insufficient resources for operation) 2: In title(main = main, sub = sub, xlab = xlab, ylab = ylab, ... : X11 protocol error: BadDrawable (invalid Pixmap or Window parameter) and the dev.off() line will give me: *** caught segfault *** address 48, cause 'memory not mapped' Traceback: 1: dev.off() Possible actions: 1: abort (with core dump, if enabled) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace My sessionInfo() R version 2.7.0 (2008-04-22) sparc-sun-solaris2.10 locale: C attached base packages: [1] stats graphics grDevices utils [5] datasets methods base My capabilities() jpeg png tcltk X11 TRUE TRUE TRUE TRUE aqua http/ftp sockets libxml FALSE TRUE TRUE TRUE fifo cledit iconv NLS TRUE TRUE TRUE TRUE profmem cairo FALSE FALSE Thanks, Stephen -- :::::::::::::::::::::::::::::::::: Stephen Weigand Division of Biostatistics Mayo Clinic Rochester, Minn., USA Phone (507) 266-1650, fax 284-9542
Prof Brian Ripley
2008-Jun-18 08:13 UTC
[Rd] tiff(), jpeg(), and png() in R 2.7.0: problems if 'units = "in"' but default height and width
Clearly you don't have cairo installed or functional, since the preferred versions of these devices do not use X11, and do trap this error.> tiff("a.tiff", units = "in", res = 1200)Error in tiff("a.tiff", units = "in", res = 1200) : unable to start device 'tiff' In addition: Warning message: In tiff("a.tiff", units = "in", res = 1200) : cairo error 'out of memory' There is nothing new here (Xlib-based devices would crash with insufficient memory 'for ever'), but we will see if we can trap this. On Mon, 16 Jun 2008, Weigand, Stephen D. wrote:> I love the new tiff(), jpeg(), and png() in R 2.7.0 but found > an issue that I didn't see reported. > > When specifying 'units = "in"' but forgetting to change the > default height and width (so the figure is unintentionally > going to be 480 inches by 480 inches) I run into problems. > > Here's the reproducible example: > > tiff("a.tiff", units = "in", res = 1200, > compression = "lzw") > hist(rnorm(10)) > dev.off() > > Before dev.off(), I get these warnings: > > Warning messages: > 1: In title(main = main, sub = sub, xlab = xlab, ylab = ylab, > ... : > X11 protocol error: BadAlloc (insufficient resources for > operation) > 2: In title(main = main, sub = sub, xlab = xlab, ylab = ylab, > ... : > X11 protocol error: BadDrawable (invalid Pixmap or Window > parameter) > > and the dev.off() line will give me: > > *** caught segfault *** > address 48, cause 'memory not mapped' > > Traceback: > 1: dev.off() > > Possible actions: > 1: abort (with core dump, if enabled) > 2: normal R exit > 3: exit R without saving workspace > 4: exit R saving workspace > > > My sessionInfo() > > R version 2.7.0 (2008-04-22) > sparc-sun-solaris2.10 > > locale: > C > > attached base packages: > [1] stats graphics grDevices utils > [5] datasets methods base > > > My capabilities() > jpeg png tcltk X11 > TRUE TRUE TRUE TRUE > aqua http/ftp sockets libxml > FALSE TRUE TRUE TRUE > fifo cledit iconv NLS > TRUE TRUE TRUE TRUE > profmem cairo > FALSE FALSE > > > Thanks, > > Stephen > > -- > :::::::::::::::::::::::::::::::::: > Stephen Weigand > Division of Biostatistics > Mayo Clinic Rochester, Minn., USA > Phone (507) 266-1650, fax 284-9542 > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Possibly Parallel Threads
- beta symbol cut off in y axis label using jpeg/png/tiff
- Unable to use jpeg(), png() etc.....
- Raster images and saving with original pixel dimensions in tiff, jpeg, or png perferablly.
- display SVG, PNG, GIF, JPEG, TIFF, PPM in new plot frame
- how to save a heatmap.2 in png /jpeg /tiff