If I have a graphic composed of several plots, say three plots arranged vertically. This is a gtable object and can be drawn to the page with:


However I see that the plot in my RStudio is 'smushed up' as in the screenshot below:

enter image description here

As you can see in the bottom right corner it is squashed and the titles overlap with other elements of the graphic.

If I hit zoom and view the plot it is a lot bigger:

enter image description here

Now I know, that if I were to export my gtable plot using pdf() or png() and such devices, I can set a width and a height, and so just make it big enough such that the plot is not squashed.

However, instead of one of those graphic devices, I would like to use export.grid, from the gridSVG package to save it to an SVG file. But if I do


Then the SVG file exported looks squashed as it does in the RStudio plot window. So my question is, how can I manipulate the dimensions of the graphic so it is drawn to SVG without it looking squashed? I draw the plot initially with grid.newpage and grid.draw, I wonder perhaps I have to specify some size of the page or drawing using grid.

Thanks, Ben.

  • export.grid() isn't an exported function in the CRAN version of gridSVG (link to gridSVG manual). – Gregor Jul 16 '15 at 20:42
  • Do you have objections to using grDevices::svg() which would work just like png() or pdf() and has width and height arguments? – Gregor Jul 16 '15 at 20:43
  • I shall try it and see how it does. I think I remember it not working so great for me though. – Ward9250 Jul 16 '15 at 21:27
  • Would it help to pop out a new graphics window with dev.new() that can be freely re-sized? – Axeman Jul 17 '15 at 9:26

Your Answer


Browse other questions tagged or ask your own question.