The basic command for sketching the graph of a real-valued function of one variable in MATHEMATICA is

which will draw the graph of y=f(x) over the closed interval [xmin,xmax] on the x-axis. More generally

will represent in one picture the graphs of y=f_{1}(x),
y=f_{2}(x), ... over the closed interval [xmin,xmax]
on the x-axis. For example the output of

is:

To get a fancier output we might add some modifiers such as

PlotRange -> {-1.5, 1.5}, Frame -> True, AxesLabel -> {"x-axis","y-axis"} ]

obtaining:

Here is a table describing some of the most useful modifiers for the PLOT command.

AspectRatio -> NN | control aspect ratio (proportions) of viewing window |

PlotRange -> {NN,NN} | set the height of the window |

Axes -> BB | include axes or not |

AxesLabel -> {"xlabel","ylabel"} | label the axes |

PlotLabel -> "text for title" | put title on graph |

Background -> Hue[NN] | color the background |

PlotStyle -> {{s_{1}},{s_{2}},...} |
set the color and the "style" of curves |

GridLines -> Automatic | add grid lines to graph |

In this table, NN denotes a numerical
value (which should be between 0 and 1 for Hue[NN]).
The symbol BB can be one of the
values
True or
False. And s_{1}
may include specifications such as Hue[NN]
(setting curve color), AbsoluteThickness[NN]
(setting curve thickness), or Dashing[{NN,NN}]
(making the curve dashed).
The modifier AspectRatio->Automatic
gives the visually true proportions (where the x- and y-axes are scaled
equally).

Instead of Hue[NN], colors can also be specified with RGBColor[NN,NN,NN]. Desired colors may be previewed and chosen using the "Color Selector" from the "Input" menu.

To illustrate the "PlotStyle" modifier, the input

PlotStyle -> { {Hue[.3],AbsoluteThickness[2]}, {Hue[.8],Dashing[{.01,.01}]} } ]

will result in:

If we want to add a frame to this picture, on the next input we could enter Show[ %, Frame->True ]. The effect of the "Show" command is to redraw the graphic (in this case the graphic in the previous output %) with the additional modifier Frame->True.

URL: http://math.ou.edu/~amiller/math/plot.htm

August, 1999