[R] large files produced from image plots?

baptiste auguie baptiste.auguie at googlemail.com
Wed Sep 8 22:00:50 CEST 2010


Hi,

I get the same crash with x11() with sessionInfo()
R version 2.11.1 (2010-05-31)
x86_64-apple-darwin9.8.0

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/C/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods
[8] base

However it works fine with quartz(). Have you tried other devices?
pdf() doesn't crash R for me, but the output is incorrect. png() is OK
but defeats the purpose here.

rasterImage is quite a recent addition, it would probably be
appreciated to report any such odd behavior to R-devel. Interestingly
(or not), the x11() test does not crash for me using grid.raster
instead of rasterImage.

Best,

baptiste







On 8 September 2010 21:47, Stephen T. <obsessively at hotmail.com> wrote:
> Hi Baptiste,
> Thanks for your suggestion. I have to look into this further, but anything I
> try with rasterImage() gives me this type of error (below is from running
> the example in the help file). This is with R 2.11.1 on OS X 10.5 -
>  *** caught bus error ***
> address 0x24, cause 'non-existent physical address'
> Traceback:
>  1: rasterImage(image, 100, 300, 150, 350, interpolate = FALSE)
> Possible actions:
> 1: abort (with core dump, if enabled)
> 2: normal R exit
> 3: exit R without saving workspace
> 4: exit R saving workspace
> This is not an obvious error, is it?
> Thanks,
> Stephen
>> Subject: Re: [R] large files produced from image plots?
>> From: baptiste.auguie at googlemail.com
>> Date: Wed, 8 Sep 2010 19:41:46 +0200
>> CC: r-help at r-project.org
>> To: obsessively at hotmail.com
>>
>> Hi,
>>
>> Have you tried the recent rasterImage() function?
>>
>> HTH,
>>
>> baptiste
>>
>> On Sep 8, 2010, at 7:30 PM, Stephen T. wrote:
>>
>> >
>> > Hi list,
>> > I wonder if anyone has thoughts on making image plots in R [using
>> > image() or image.plot(), or filled.contour()]- I've made quite a bit now,
>> > but they seem quite large in size when exported to pdf file format (even
>> > after compressing with pdftk or ghostscript, which I regularly do). I know
>> > that for "images", raster graphics output (png, tiff) may be the way to go,
>> > but often the ones I make are multi-panel plots with other graphics on them,
>> > and are usually included in a LaTeX document (PDFLaTeX does accept png) and
>> > require stretching/shrinking (and/or possibly editing with Adobe
>> > Illustrator). I have had some luck exporting image plots from Matlab (to
>> > postscript or pdf) before in the sense that the files seem smaller and less
>> > pixelated. Is this a difference in the way image() plots are produced, or
>> > with the way the image is written to the pdf() device (if anyone is familiar
>> > with other image-exporting programs...)? The other day I had a 13MB dataset,
>> > and probably plotted 3/4 of it!
>> > using image() and the compressed pdf output was about 8 MB (it contained
>> > other stuff but was an addition of a few KB). I tried filled.contour(), as I
>> > understand that it colors polygons to fill contours instead of coloring
>> > rectangles at each pixel - and it has saved me before - but this time the
>> > contours may have been too sharp as as its compressed pdf came out to be 62
>> > MB... (ouch!). I have not tested this data set with other software programs
>> > so it may just have been a difficult data set.
>> > Is there a good solution to this (or is it simply not to use a
>> > vector-graphics format in these instances), and just for my curiosity, are
>> > you aware of any things that other software (data analysis) programs do uder
>> > the hood to make their exported images smaller/smoother?
>> > Thanks much!
>> > Stephen
>> > [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > 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.
>>
>



More information about the R-help mailing list