png() function in R fail to create png file with dimension larger than 3000x3000px

ggplot2, png, r

Solution

`Unable to allocate bitmap` suggest you have memory problems, so I would experiment with smaller allocations, provide details about your system and some reproducible code.

What you describe works for me - though I wouldn't advise actually running this since it creates a pretty wasteful file:

png("a.png", width = 3000, height = 3000)
image(matrix(rnorm(3000*3000), 3000), useRaster = TRUE)
dev.off()

Problem

I have trying to generate some map using `ggplot` and `sp`, I have a basemap with the original size of `3000+ x 3000+` pixels, I also have some with `2000+ x 2000+` pixels. Interestingly, until now I still cannot create the `3000+ x 3000+` pixel png files, as R gives me the following error: ``` Error in png(chart.filename, width = basemap.xlength, height = basemap.ylength, : unable to start png() device In addition: Warning messages: 1: In png(chart.filename, width = basemap.xlength, height = basemap.ylength, : Unable to allocate bitmap 2: In png(chart.filename, width = basemap.xlength, height = basemap.ylength, : opening device failed ``` Is that a limitation to R? Can how I get through it? Thanks. I am using Win7 with R 2.15.0.

Original source