From ripley at stats.ox.ac.uk  Wed Jun 18 10:13:24 2008
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Wed, 18 Jun 2008 09:13:24 +0100 (BST)
Subject: [Rd] tiff(), jpeg(),
 and png() in R 2.7.0: problems if 'units = "in"' but default height
 and width
In-Reply-To: <4856D83A.40505@mayo.edu>
References: <4856D83A.40505@mayo.edu>
Message-ID: <alpine.LFD.1.10.0806180908450.6531@auk.stats.ox.ac.uk>

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



[Rd] tiff(), jpeg(), and png() in R 2.7.0: problems if 'units = "in"' but default height and width
Prof Brian Ripley