Redrawing and Combining Plots

Mathematica saves information about every plot you produce, so that you can later redraw it. When you redraw plots, you can change some of the options you use.

Show[plot,option->value]redraw a plot with options changed
Show[plot1,plot2,...]combine several plots
GraphicsGrid[{{plot1,plot2,...},...}]draw an array of plots
InputForm[plot]show the underlying textual description of the plot

Functions for manipulating plots.

Here is a simple plot.
Click for copyable input
When you redraw the plot, you can change some of the options. This changes the choice of scale.
Click for copyable input
This takes the plot from the previous line, and changes another option in it.
Click for copyable input

By using Show with a sequence of different options, you can look at the same plot in many different ways. You may want to do this, for example, if you are trying to find the best possible setting of options.

You can also use Show to combine plots. All of the options for the resulting graphic will be based upon the options of the first graphic in the Show expression.

This sets to be a plot of from to .
Click for copyable input
Here is a plot of from to .
Click for copyable input
Plot specifies an explicit PlotRange for each graphic.
Click for copyable input
This uses PlotRange to override the explicit value set for .
Click for copyable input

All Mathematica graphics are expressions and can be manipulated in the same way as any other expression. Doing these kinds of manipulations does not require the use of Show.

This replaces all instances of the symbol Line with the symbol Point in the graphics expression represented by .
Click for copyable input

Using Show[plot1, plot2, ...] you can combine several plots into one. GraphicsGrid allows you to draw several plots in an array.

GraphicsGrid[{{plot11,plot12,...},...}] draw a rectangular array of plots
GraphicsRow[{plot1,plot2,...}]draw several plots side by side
GraphicsColumn[{plot1,plot2,...}]draw a column of plots
GraphicsGrid[plots,Spacings->{h,v}]put the specified horizontal and vertical spacing between the plots

Drawing arrays of plots.

This shows the previous plots in an array.
Click for copyable input
If you redisplay an array of plots using Show, any options you specify will be used for the whole array, rather than for individual plots.
Click for copyable input

GraphicsGrid by default puts a narrow border around each of the plots in the array it gives. You can change the size of this border by setting the option Spacings->{h, v}. The parameters h and v give the horizontal and vertical spacings to be used. The Spacings option uses the width and height of characters in the default font to scale the h and v parameters by default, but it is generally more useful in graphics to use Scaled coordinates. Scaled scales widths and heights so that a value of represents the width and height of one element of the grid.

This increases the horizontal spacing, but decreases the vertical spacing between the plots in the array.
Click for copyable input

When you make a plot, Mathematica saves the list of points it used, together with some other information. Using what is saved, you can redraw plots in many different ways with Show. However, you should realize that no matter what options you specify, Show still has the same basic set of points to work with. So, for example, if you set the options so that Mathematica displays a small portion of your original plot magnified, you will probably be able to see the individual sample points that Plot used. Options like PlotPoints can only be set in the original Plot command itself. (Mathematica always plots the actual points it has; it avoids using smoothed or splined curves, which can give misleading results in mathematical graphics.)

Here is a simple plot.
Click for copyable input
This shows a small region of the plot in a magnified form. At this resolution, you can see the individual line segments that were produced by the original Plot command.
Click for copyable input
New to Mathematica? Find your learning path »
Have a question? Ask support »