Often, to maximize space for code (console + terminal), I shrink the plotting window as seen here:
Whenever I need to plot something, I just pop out the plotting window to preview my beautiful data in its full glory.
However, all too often, this is interrupted by having shrunk the plotting area -- an error is returned since there's no room for the plot. Almost always this is the "figure margins too large" error observed here (actually I got a warning since I shrunk the window after it had already plotted), but I've also seen it in the form of a warning about "zero-length-arrows" from arrows
(since in the shrunk window, it's easy to put in data that leads to arrows less than 1/100" in width, the threshold obeyed there).
When presented with such an error, there are two options, both of which are none too convenient:
- Don't use
RStudioGD
. Just pipe the preview plot topdf
/png
/whatever external device, and open the file. This defeats the purpose of having a plotting window in RStudio. - Unshrink the plot window. This is annoying because 1) I have to shrink my code as a tradeoff and 2) it's sometimes an iterative process, re-plotting as I balloon the window little by little -- how much space is too little?
I see a few potential solutions:
- Don't render the plot if RStudio recognizes its graphics device is too small -- display a warning in the plotting window (much akin to the one seen above) asserting that the window must be expanded or popped out before rendering will happen.
- Allow an option to always open a new window for newly generated plots (pre-popping the window); this is essentially a version of the first workaround from above, but doesn't require creating temporary/ephemeral plot files.