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
?
Graphics
objects side-by-side. It's almost like I am looking for a way to flatten aGrid
objects so that twoGraphics
objects in neighboring cells are combined into a singleGraphics
object. $\endgroup$Graphics
object? What properties do singleGraphics
objects have that you need to rely on later? This is a very important question. You can combine them usingInset
s, but I'm not sure you'll like the result, as it might not behave the way you expect when you resize it. $\endgroup$