plot::setDefault

Set default setting of attributes

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

plot::setDefault(type::attr = value, …)

Description

plot::setDefault(plot::Object::Attribute = Value) sets the default of the attribute Attribute for objects of type plot::Object to Value.

While not all attributes have defaults, it is in general possible to set defaults for them, although some examples like setting a default function to plot for plot::Function2d are probably more exotic than others, to say the least.

Defaults are set and retrieved per object; with the exception of OutputFile and OutputOptions, the attribute must be prefixed with the name of the object type the setting shall be valid for. There is, e.g., no function to turn of all lines on all 3D objects. OutputFile and OutputOptions are not associated with an object and must be set directly.

To delete a default (which is not recommended for attributes having a default in the standard installation), set value to FAIL.

Examples

Example 1

By default, function plots use relatively thin lines:

plotfunc2d(sin(x))

For some applications, this is undesirable, for example when projecting graphics for a larger audience. It is always possible to set thicker lines in the call:

plotfunc2d(sin(x), LineWidth = 1*unit::mm)

However, this is distracting and cumbersome. Using plot::setDefault, we change the default setting once and for the whole session:

plot::setDefault(plot::Function2d::LineWidth = 1*unit::mm):
plotfunc2d(sin(x))

One thing you should know in this context: plotfunc2d and plotfunc3d use plot::Function2d and plot::Function3d for the actual plotting. Changing color and legend settings of the latter two does not influence the former, however, since plotfunc2d and plotfunc3d set color and legend settings explicitly.

Parameters

type

A domain of the plot library, i.e., an object type such as plot::Function2d

attr

Attributes admissible for the object type type

value

The new default value: a value admissible for attr in objects of type type

Return Values

plot::setDefault returns the previous default value(s). plot::getDefault returns the current default value.

Algorithms

"Admissible attributes" includes all the attributes the object itself reacts to. Hints cannot be set or changed with plot::setDefault.

For attributes marked as "mandatory," default values are read and used the moment an object is created. Default values of attributes marked as "optional" or "inherited" are read when the object is plotted and can therefore be changed after creating an object.

See Also

MuPAD Functions

Was this topic helpful?