How to | Combine Two or More Graphics

When working with graphics in Mathematica, you may want to combine several graphics into a single image. Mathematica can combine graphics by overlaying them or by embedding them together in different orders.

One of the most common ways to combine graphics is by using Show.

Set up some graphics to combine, stored in this example as , , , and :

In[12]:=
Click for copyable input
Out[12]=
In[13]:=
Click for copyable input
Out[13]=
In[14]:=
Click for copyable input
Out[14]=
In[37]:=
Click for copyable input
Out[37]=

Overlay the graphics by using Show:

In[38]:=
Click for copyable input
Out[38]=

Display the full plot range using PlotRange->All:

In[39]:=
Click for copyable input
Out[39]=

Graphics can also be placed together in a row, grid, or column if you do not want to overlay them.

Use GraphicsRow to put the graphics in a row:

In[40]:=
Click for copyable input
Out[40]=

Use GraphicsGrid to put them in a grid:

In[41]:=
Click for copyable input
Out[41]=

Use GraphicsColumn to put them in a column:

In[42]:=
Click for copyable input
Out[42]=
    

The graphics options Epilog and Prolog can also be used to combine graphics. They work by embedding graphics together, but differ in the order in which they embed graphics.

Epilog works by embedding a graphic on top of another graphic.

Use Epilog as an option within Graphics to embed a point onto a line:

In[87]:=
Click for copyable input
Out[87]=

Prolog works by embedding a graphic behind another graphic.

Use Prolog as an option to Graphics to embed a point behind a line:

In[88]:=
Click for copyable input
Out[88]=
    

Show and Epilog can also be used with 3D graphics.

Make two 3D graphics and combine them using Show:

In[52]:=
Click for copyable input
Out[52]=
In[53]:=
Click for copyable input
Out[53]=
In[54]:=
Click for copyable input
Out[54]=

You can use Epilog to embed a 2D graphic within a 3D graphic.

Add a watermark to a 3D graphic by using Epilog as an option within SphericalPlot3D:

In[35]:=
Click for copyable input
Out[35]=
In[36]:=
Click for copyable input
Out[36]=
New to Mathematica? Find your learning path »
Have a question? Ask support »