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

Greg Snow Greg.Snow at imail.org
Fri Sep 3 18:04:14 CEST 2010


Some thoughts on your question about having pairs increase the size of the device:

The pairs function is fairly old (and plot even older) and fully adjustable graphics devices are actually fairly recent.  I remember a time when the only way to get high quality color plots was to send the plot to a pen plotter (Last I checked S-PLUS still has a graphics driver for some plotters, I don't think R ever did or likely will), this had a mechanical arm that would move a pen around on a piece of paper (this is also why colors were originally designated by number not color name, the program did not know which pen was red (you could move them around), so you would just say use pen number 2).  How would a plotting function in a computer program resize a physical piece of paper?

There are advantages to keeping graphics devices and plotting functions separate.  There are probably more than I know, but one simple one is that I was able to write the pairs2 function (well the pieces that I did not steal from pairs) without knowing anything about controlling devices.  If I would have had to think about sizes of devices, I probably would not have even tried writing the function.

With the ability to specify your own panel functions, that is asking quite a bit of the programmers of pairs to figure out what is too small, some panel functions could easily be meaningful even at small sizes (single pixels where the main information is in the color).  See fortune(226).

Resizing devices may be a good idea for your specific case, but I am uncomfortable with the program in general taking that control away from me (but then I really dislike calculators that don't have an off button, I want the illusion of control of at least being able to turn it off, not let it decide when to shut itself off (I'm not paranoid if the machines really are out to get me, right?))

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: Jocelyn Paine [mailto:popx at j-paine.org]
> Sent: Thursday, September 02, 2010 10:16 PM
> To: Greg Snow
> Cc: r-help at r-project.org
> Subject: RE: [R] Making plots in big scatterplot matrix large enough to
> see
> 
> 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
> 
> 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