This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Documentation / Mathematica / The Mathematica Book / Principles of Mathematica / The Structure of Graphics and Sound /

2.10.6 Making Plots within Plots

Section 1.9.3 described how you can make regular arrays of plots using GraphicsArray. Using the Rectangle graphics primitive, however, you can combine and superimpose plots in any way.

Creating a subplot.

Here is a three-dimensional plot.

In[1]:= p3 = Plot3D[Sin[x] Exp[y], {x, -5, 5}, {y, -2, 2}]

Out[1]=

This creates a two-dimensional graphics object which contains two copies of the three-dimensional plot.

In[2]:= Show[Graphics[ {Rectangle[{0, 0}, {1, 1}, p3],
Rectangle[{0.8, 0.8}, {1.2, 1.4}, p3]} ]]

Out[2]=

Mathematica can render any graphics object within a Rectangle. In all cases, what it puts in the rectangle is a scaled down version of what would be obtained if you displayed the graphics object on its own. Notice that in general the display area for the graphics object will be sized so as to touch at least one pair of edges of the rectangle.