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

Peter Ehlers ehlers at ucalgary.ca
Fri Sep 3 06:56:44 CEST 2010


On 2010-09-02 22:16, Jocelyn Paine wrote:
> Greg, thanks for the suggestion. That's useful to know for future work.
> It's not so good in this case, because I'm making the plots for a
> colleague who doesn't know R, and it would be a bother for me to have to
> send him several files and him reassemble them. What I did was to use
> pairs.panels, as suggested by William Revelle on this thread.
>
> I'd like to ask a general question about the interface though. There's a
> size below which individual scatterplots are not legible. It makes no
> sense at all for a scatterplot routine to plot them at that size or
> smaller. So why didn't the author(s) of 'pairs' program it so that it
> always makes them at least legible size, and expands the image window
> until it can fit them all in?
>
> Regards,
>
> Jocelyn Paine
> http://www.j-paine.org
> +44 (0)7768 534 091

Hmm, I had no trouble creating and viewing William's pdf file.
I was also able to view the pairs plot fairly well on my screen.
And that's on my laptop. Perhaps my display has better resolution
than yours.

Your suggestion to "expand the image window until it can fit them
all in" would, at the very least, involve determining the resolution
of the display device. But even then, there's bound to be someone
who'll want a pairs plot for 1000 variables.

As usual with R, improvements are always welcome.
You could submit appropriate code and, if it is deemed useful,
I'm fairly sure that a better pairs() function will become
part of Rx.xx.x.

   -Peter Ehlers

>
> Jocelyn's Cartoons:
> http://www.j-paine.org/blog/jocelyns_cartoons/
>
> On Tue, 31 Aug 2010, Greg Snow wrote:
>
>> Look at the pairs2 function in the TeachingDemos package, this lets you
>> produce smaller portions of the total scatterplot matrix at a time (with
>> bigger plots), you could print the smaller portions then assemble the
>> full matrix on a large wall, or just use it to look at potentially
>> interesting parts.
>>
>> --
>> Gregory (Greg) L. Snow Ph.D.
>> Statistical Data Center
>> Intermountain Healthcare
>> greg.snow at imail.org
>> 801.408.8111
>>
>>
>>> -----Original Message-----
>>> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
>>> project.org] On Behalf Of Jocelyn Paine
>>> Sent: Monday, August 30, 2010 10:21 PM
>>> To: r-help at r-project.org
>>> Subject: [R] Making plots in big scatterplot matrix large enough to see
>>>
>>> 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.
>>



More information about the R-help mailing list