[R] Making plots in big scatterplot matrix large enough to see

Jocelyn Paine popx at j-paine.org
Tue Aug 31 06:21:21 CEST 2010


I've got a data frame with 23 columns, and wanted to plot a scatterplot 
matrix of it. I called
   pairs( df )
where 'df' is my data frame. This did generate the matrix, but the 
plotting window did not expand to make the individual plots large enough 
to see. Each one was only about 10 pixels high and wide.

I tried sending the plot to a file, with a high and wide image, 
by doing
   png( "plot.png", width = 4000, height = 4000 )
but I got these errors:
   Error in png( "plot.png", width = 4000, height = 4000 ) :
   unable to start device
   In addition: Warning messages:
   1: In png( "plot.png", width = 4000, height = 4000 ) :
      Unable to allocate bitmap
   2: In png( "plot.png", width = 4000, height = 4000 ) :
      opening device failed

The messages aren't helpful, because they don't tell you _why_ R can't 
start the device, allocate it, or open it. The documentation for png says:
   Windows imposes limits on the size of bitmaps: these are not documented
   in the SDK and may depend on the version of Windows. It seems that width
   and height are each limited to 2^15-1.
However, 2^15-1 is 32767, so that isn't the problem here. I tried various 
values for height and width. 2400 was OK, but 2500 wasn't. So it seems R 
can't produce plots that are more than about 2400 pixels square. This is 
with R 2.10.1.

Why is png failing on big images? Also, what's the recommended way to make 
a file containing a scatterplot matrix when you have lots of variables? 
'pairs' is a very useful function, but obviously one does need to be 
careful when doing this, and I don't know what experts would recommend. Do 
you loop round the variables plotting each pair to a different file? I was 
hoping that I could put them all into one very big image and view parts of 
it at a time.

Thanks,

Jocelyn Paine
http://www.j-paine.org
http://www.spreadsheet-parts.org
+44 (0)7768 534 091



More information about the R-help mailing list