Suppose that I have two plots, pl1 and pl2:

pl1 = Plot[x, {x, 0, 1}, Frame -> True, ImageSize -> 350]
pl2 = Plot[x^2, {x, 0, 1}, Frame -> True, ImageSize -> 350]



I would like to (1) combine these plots side-by-side in a (2) non-rasterized graphic with (3) no spacing.

I get pretty close to my desired result by using Grid with Spacings -> 0:

Grid[{{pl1, pl2}}, Spacings -> 0]


The above satisfies my requirements (2) and (3): the result is non-rasterized, and there is no spacing between the plots. However, the above doesn't satisfy my requirement (1), that the plots be combined into a single Graphic object. That is, if I click on either of the plots, I see that they are separate Graphic objects:



So the above approach doesn't satisfy all of my requirements. (Why do I need the plots to be combined in a single Graphic? The reason is that I want to be able to place other Graphic objects -- e.g., text, arrows, shapes, etc. -- that span the two plots.)

Another possibility is to use ImageAssemble, but unfortunately this leads to a rasterized image:

ImageAssemble[{{pl1, pl2}}]


A third possibility is to use GraphicsGrid with Spacings -> 0:

GraphicsGrid[{{pl1, pl2}}, Spacings -> 0]


It seems that this produces a single Graphic object ((1)) that is not rasterized ((2)), but, unfortunately, there is spacing between the plots.

Do you have any suggestions? Is there any way to remove the spacing/padding in GraphicsGrid?

  • $\begingroup$ @Jens Thanks. I think my question is more general, though. I just want to combine two Graphics objects side-by-side. It's almost like I am looking for a way to flatten a Grid objects so that two Graphics objects in neighboring cells are combined into a single Graphics object. $\endgroup$
    – Andrew
    Commented Mar 11, 2014 at 21:11
  • 1
    $\begingroup$ Why do you need the result to be a single Graphics object? What properties do single Graphics objects have that you need to rely on later? This is a very important question. You can combine them using Insets, but I'm not sure you'll like the result, as it might not behave the way you expect when you resize it. $\endgroup$
    – Szabolcs
    Commented Mar 11, 2014 at 22:15
  • $\begingroup$ Nowadays I use SciDraw for figures with multiple panels: mathematica.stackexchange.com/a/37880/12 But again, you can't resize a SciDraw figure directly. You have to decide on the size when you make it. $\endgroup$
    – Szabolcs
    Commented Mar 11, 2014 at 22:16

1 Answer 1


You could do something like the following:

 ImagePadding-> {{None,Scaled[0.05]},{Automatic,Automatic}}];


enter image description here

This removes the padding from the graphics themselves with the option ImagePadding, and a magic number of -0.07...There is likely a better way.

  • $\begingroup$ Unfortunately, in this answer, the result is not a single Graphic object. Sorry. $\endgroup$
    – Andrew
    Commented Mar 11, 2014 at 20:32
  • $\begingroup$ Yikes you are right... $\endgroup$
    – chuy
    Commented Mar 11, 2014 at 20:36
  • $\begingroup$ changed to make result a Graphics $\endgroup$
    – chuy
    Commented Mar 11, 2014 at 21:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.