5

I have a dataframe which contains 23 continuous variables. Before I start analyzing the data, I want to check for correlations.

I usually do this by the pairs() function, like this:

pairs(mydata, lower.panel = panel.smooth2, 
      upper.panel = panel.cor, diag.panel = panel.hist)

Of course, I have specified the panels beforehand with a function.

Now when I want to do this with my data containing 23 variables, thus producing a 23 x 23 matrix of plots, I get the following error:

Error in plot.new() : figure margins too large

It looks like I have to adjust my plot size or something. How do I do this?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Koentjes
  • 163
  • 1
  • 3
  • 10
  • 2
    Any common computer screen will be worthless in display this kind of image from the default device. Have you tried plotting to a file? – Roman Luštrik May 02 '13 at 08:13
  • 1
    try `x11()` to plot to a new window. works sometimes. – Nishanth May 02 '13 at 08:58
  • Nit: your data are *not* continuous by definition. – Carl Witthoft May 02 '13 at 11:46
  • 2
    Hi all, thank you for the replies. Eventually I fixed it in a very simple way. I work in RStudio and this problem can be avoided simply by enlarging the graph window in your RStudio program. – Koentjes May 02 '13 at 13:41
  • 1
    So its good to know that enlarging the graph window can solve this problem, but how about a generalized solution? i have for instance 54 features and i'm running into the same problem, enlarging the graph window did not solve the problem. Also, using a device did not work: ```pdf("pairs.pdf") pairs(DT) dev.off()``` – Michahell May 15 '14 at 20:37
  • This is really a specific case of http://stackoverflow.com/questions/12766166/error-in-plot-new-figure-margins-too-large-in-r, but the answer is the same: enlarge your plotting device or reduce the margins. With 23 variables it is unlikely your plot will be readable anyway. – Calimo Feb 06 '15 at 08:48

0 Answers0