The png () function in R does not create a png file larger than 3000x3000 pixels

I am trying to create some map using ggplot

and sp

, I have a basemap with original 3000+ x 3000+

pixel size , I also have some with 2000+ x 2000+

pixels. Interestingly, until now I still cannot create png png files 3000+ x 3000+

, as R is giving 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 this a limitation for R? Can I get through this? Thank.

I am using Win7 with R 2.15.0.

+3


source to share


1 answer


Unable to allocate bitmap

suggests you have memory issues, so I would experiment with smaller allocations, provide details about your system, and some reproducible code.

What you describe works for me - although I wouldn't advise actually running this as it creates a rather wasteful file:



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

      

+3


source







All Articles