Manipulating Options

There are a number of functions built into the Wolfram Language which, like (RefLink[Plot, paclet:ref/Plot]), have various options you can set. The Wolfram Language provides some general mechanisms for handling such options.

If you do not give a specific setting for an option to a function like (RefLink[Plot, paclet:ref/Plot]), then the Wolfram Language will automatically use a default value for the option. The function (RefLink[Options, paclet:ref/Options])[function,option] allows you to find out the default value for a particular option. You can reset the default using (RefLink[SetOptions, paclet:ref/SetOptions])[function,option->value]. Note that if you do this, the default value you have given will stay until you explicitly change it.

Manipulating default settings for options.

Here is the default setting for the (RefLink[PlotRange, paclet:ref/PlotRange]) option of (RefLink[Plot, paclet:ref/Plot]):

Options[Plot,PlotRange]

This resets the default for the (RefLink[PlotRange, paclet:ref/PlotRange]) option. The semicolon stops the Wolfram Language from printing out the rather long list of options for (RefLink[Plot, paclet:ref/Plot]):

SetOptions[Plot,PlotRange->All];

Until you explicitly reset it, the default for the (RefLink[PlotRange, paclet:ref/PlotRange]) option will now be (RefLink[All, paclet:ref/All]):

Options[Plot,PlotRange]

The graphics objects that you get from (RefLink[Plot, paclet:ref/Plot]) or (RefLink[Show, paclet:ref/Show]) store information on the options they use. You can get this information by applying the (RefLink[Options, paclet:ref/Options]) function to these graphics objects.

Getting information on options used in plots.

Here is a plot, with default settings for all options:

g=Plot[SinIntegral[x],{x,0,20}]

The setting used for the (RefLink[PlotRange, paclet:ref/PlotRange]) option was (RefLink[All, paclet:ref/All]):

Options[g,PlotRange]

(RefLink[AbsoluteOptions, paclet:ref/AbsoluteOptions]) gives the absolute automatically chosen values used for (RefLink[PlotRange, paclet:ref/PlotRange]):

AbsoluteOptions[g,PlotRange]

While it is often convenient to use a variable to represent a graphic as in the above examples, the graphic itself can be evaluated directly. The typical ways to do this in the notebook interface are to copy and paste the graphic or to simply begin typing in the graphical output cell, at which point the output cell will be converted into a new input cell.

When a plot created with no explicit (RefLink[ImageSize, paclet:ref/ImageSize]) is placed into an input cell, it will automatically shrink to more easily accommodate input.

The following input cell was created by copying and pasting the graphical output created in the previous example:

AbsoluteOptions[, PlotRange]