[R] Making plots in big scatterplot matrix large enough to see
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
greg.snow at imail.org
> -----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
> 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
> 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
> 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?
> Jocelyn Paine
> +44 (0)7768 534 091
> Jocelyn's Cartoons:
> On Tue, 31 Aug 2010, Greg Snow wrote:
> > Look at the pairs2 function in the TeachingDemos package, this lets
> > produce smaller portions of the total scatterplot matrix at a time
> > 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
> >> I've got a data frame with 23 columns, and wanted to plot a
> >> 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
> >> 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
> >> 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
> >> R
> >> can't produce plots that are more than about 2400 pixels square.
> >> is
> >> with R 2.10.1.
> >> Why is png failing on big images? Also, what's the recommended way
> >> make
> >> a file containing a scatterplot matrix when you have lots of
> >> '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
> >> Do
> >> you loop round the variables plotting each pair to a different file?
> >> was
> >> hoping that I could put them all into one very big image and view
> >> 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