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

Jocelyn Paine popx at j-paine.org
Fri Sep 3 05:59:11 CEST 2010


William,

Thanks. I adapted your example by doing:
   library(psych)
   pdf(file="myfile.pdf",width=30,height=30)
   pairs.panels(data,gap=0)
   dev.off()

The R part worked. I could see it doing so when I replaced the call to 
'pdf' by
   windows(width=30,height=30)
. The remaining problem was that Adobe Reader only displayed ten rows of 
my file, and then hung. That doesn't surprise me, because it's an 
unreliable piece of software, often hanging on PDFs I find on Google. 
Annoying, though.

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

On Tue, 31 Aug 2010, William Revelle wrote:

> Jocelyn,
>  In a partial answer to your question, try setting gap=0 in the calls to 
> pairs.  This will make the plots closer together.
>
> (You might also find pairs.panels in the psych package useful,  -- it 
> implements one of the help examples for pairs to report the histogram on the 
> diagonal and reports the correlations in the upper off diagonal).
>
> On a Mac, I just tried setting
> quartz(width=30, height=30)   #make a big graphics window
>
>
> #then
> library(psych)
> my.data <- sim.item(24)  #create 500 cases of 24 variables
> pairs.panels(my.data, gap=0)  #the gap =0 makes the plots right next to each 
> other
>
> #And then save the graphics window as a pdf.  I can open this in a pdf  and 
> scroll around pretty easily.
>
>
> Bill
>
> At 5:21 AM +0100 8/31/10, Jocelyn Paine wrote:
>> 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
>> 
>> ______________________________________________
>> 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.
>
>
> -- 
> William Revelle		http://personality-project.org/revelle.html
> Professor			http://personality-project.org
> Department of Psychology             http://www.wcas.northwestern.edu/psych/
> Northwestern University	http://www.northwestern.edu/
> Use R for psychology                       http://personality-project.org/r
> It is 6 minutes to midnight	http://www.thebulletin.org
>



More information about the R-help mailing list