MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
Note: To easily plot functions in MATLAB^{®}, see Create Plots in Symbolic Math Toolbox™. |
The probably most important graphical task in a mathematical
context is to visualize function graphs, i.e., to plot functions.
There are two graphical routines plotfunc2d
and plotfunc3d
which allow to create 2D plots
of functions with one argument (such as f(x) = sin(x)
, f(x)
= x*ln(x)
etc.) or 3D plots of functions with two arguments
(such as f(x, y) = sin(x^2 + y^2)
, f(x,
y) = y*ln(x) - x*ln(y)
etc.). The calling syntax is simple:
just pass the expression that defines the function and, optionally,
a range for the independent variable(s).
plotfunc2d
We consider 2D examples, i.e., plots of univariate functions y = f(x). Here is one period of the sine function:
plotfunc2d(sin(x), x = 0..2*PI):
If several functions are to be plotted in the same graphical scene, just pass a sequence of function expressions. All functions are plotted over the specified common range:
plotfunc2d(sin(x)/x, x*cos(x), tan(x), x = -4..4):
Functions that do not allow a simple symbolic representation
by an expression can also be defined by a procedure
that produces
a numerical value f(x) when
called with a numerical value x from
the plot range. In the following example we consider the largest eigenvalue
of a symmetric 3×3 matrix
that contains a parameter x.
We plot this eigenvalue as a function of x:
f := x -> max(numeric::eigenvalues(matrix([[-x, x, -x ], [ x, x, x ], [-x, x, x^2]]))): plotfunc2d(f, x = -1..1):
The name x used
in the specification of the plotting range provides the name that
labels the horizontal axis. Functions can also be defined by piecewise
objects:
plotfunc2d(piecewise([x < 1, 1 - x], [1 < x and x < 2, 1/2], [x > 2, 2 - x]), x = -2..3)
Note that there are gaps in the definition of the function above:
no function value is specified for x =
1 and x =
2. This does not cause any problem, because plotfunc2d
simply
ignores all points that do not produce real numerical values. Thus,
in the following example, the plot is automatically restricted to
the regions where the functions produce real values:
plotfunc2d(sqrt(8 - x^4), ln(x^3 + 2)/(x - 1), x = -2 ..2):
When several functions are plotted in the same scene, they are
drawn in different colors that are chosen automatically. With the Colors
attribute
one may specify a list of RGB colors
that plotfunc2d
shall
use:
plotfunc2d(x, x^2, x^3, x^4, x^5, x = 0..1, Colors = [RGB::Red, RGB::Orange, RGB::Yellow, RGB::BlueLight, RGB::Blue]):
Animated 2D plots of functions are created by passing function expressions depending on a variable (x, say) and an animation parameter (a, say) and specifying a range both for x and a:
plotfunc2d(cos(a*x), x = 0..2*PI, a = 1..2):
Once the plot is created, the first frame of the picture appears as a static plot. After clicking on the picture, the graphics tool starts playing the animation. There are the usual controls to stop, start, and fast-forward/rewind the animation.
The default number of frames of the animation is 50.
If a different value is desired, just pass the attribute Frames
= n
, where n is
the number of frames that shall be created:
plotfunc2d(sin(a*x), sin(x - a), x = 0..PI, a = 0..4*PI, Colors = [RGB::Blue, RGB::Red], Frames = 200):
Apart from the color specification or the Frames
number, there
is a large number of further attributes that may be passed to plotfunc2d
. Each attribute
is passed as an equation AttributeName = AttributeValue
to plotfunc2d
. Here, we
only present some selected attributes. See the section on attributes for plotfunc for
further tables with more attributes.
attribute name | possible values/example | meaning | default |
---|---|---|---|
Height | 8*unit::cm | physical height of the picture | 80*unit::mm |
Width | 12*unit::cm | physical width of the picture | 120*unit::mm |
Footer | string | footer text | "" (no footer) |
Header | string | header text | "" (no header) |
Title | string | title text | "" (no title) |
TitlePosition | [ real value, real value] | coordinates of the lower left corner of the title | |
GridVisible | TRUE , FALSE | visibility of "major" grid lines in all directions | FALSE |
SubgridVisible | TRUE , FALSE | visibility of "minor" grid lines in all directions | FALSE |
AdaptiveMesh | integer ≥ 2 | number of sample points of the numerical mesh | 121 |
Axes | None , Automatic , Boxed ,
Frame , Origin | axes type | Automatic |
AxesVisible | TRUE , FALSE | visibility of all axes | TRUE |
AxesTitles | [string, string] | titles of the axes | ["x","y"] |
CoordinateType | LinLin , LinLog ,
LogLin , LogLog | linear-linear, linear-logarithmic, logarithmic-linear, log-log | LinLin |
Colors | list of RGB values | line colors | first 10 entries of RGB::ColorList |
Frames | integer ≥ 0 | number of frames of an animation | 50 |
LegendVisible | TRUE , FALSE | legend on/off | TRUE |
LineColorType | Dichromatic , Flat , Functional ,
Monochrome , Rainbow | color scheme | Flat |
Mesh | integer ≥ 2 | number of sample points of the numerical mesh | 121 |
Scaling | Automatic , Constrained ,
Unconstrained | scaling mode | Unconstrained |
TicksNumber | None , Low , Normal ,
High | number of labeled ticks at all axes | Normal |
VerticalAsymptotesVisible | TRUE , FALSE | vertical asymptotes on/off | TRUE |
ViewingBoxYRange | ymin..ymax | restricted viewing range in y direction | Automatic |
YRange | ymin..ymax | restricted viewing range in y direction
(equivalent to ViewingBoxYRange ) | Automatic |
The following plot example features the notorious function that oscillates wildly near the origin:
plotfunc2d(sin(1/x), x = -0.5..0.5):
Clearly, the default of 121 sample
points used by plotfunc2d
does
not suffice to create a sufficiently resolved plot. We increase the
number of numerical mesh points via the Mesh
attribute. Additionally,
we increase the resolution depth of the adaptive plotting mechanism
from its default value AdaptiveMesh = 2
to AdaptiveMesh
= 4
:
plotfunc2d(sin(1/x), x = -0.5..0.5, Mesh = 500, AdaptiveMesh = 4):
The following call specifies a header via Header =
"The function sin(x^2)"
. The distance between labeled ticks
is set to 0.5 along the x axis
and to 0.2 along the y axis
via XTicksDistance = 0.5
and YTicksDistance
= 0.2
, respectively. Four additional unlabeled ticks between
each pair of labeled ticks are set in the x direction
via XTicksBetween = 4
. One additional unlabeled
tick between each pair of labeled ticks in the y direction
is requested via YTicksBetween = 1
. Grid lines
attached to the ticks are "switched on" by GridVisible
= TRUE
and SubgridVisible = TRUE
:
plotfunc2d(sin(x^2), x = 0..7, Header = "The function sin(x^2)", XTicksDistance = 0.5, YTicksDistance = 0.2, XTicksBetween = 4, YTicksBetween = 1, GridVisible = TRUE, SubgridVisible = TRUE):
When singularities are found in the function, an automatic clipping is called trying to restrict the vertical viewing range in some way to obtain a "reasonably" scaled picture. This is a heuristic approach that sometimes needs a helping adaptation "by hand". In the following example, the automatically chosen range between y ≈ - 1 and y ≈ 440 in vertical direction is suitable to represent the 6th order pole at x = 1, but it does not provide a good resolution of the first order pole at x = - 1:
plotfunc2d(1/(x + 1)/(x - 1)^6, x = -2..2):
There is no good viewing range that is adequate for both poles
because they are of different order. However, some compromise can
be found. We override the automatic viewing range suggested by plotfunc2d
and request
a specific viewing range in vertical direction via ViewingBoxYRange
:
plotfunc2d(1/(x + 1)/(x - 1)^6, x = -2..2, ViewingBoxYRange = -10..10):
The values of the following function have a lower bound but
no upper bound. We use the attribute ViewingBoxYRange = Automatic..10
to
let plotfunc2d
find
a lower bound for the viewing box by itself whilst requesting a specific
value of 10 for the upper
bound:
plotfunc2d(exp(x)*sin(PI*x) + 1/(x + 1)^2/(x - 1)^4, x = -2..2, ViewingBoxYRange = Automatic..10):
plotfunc3d
We consider 3D examples, i.e., plots of bivariate functions z = f(x, y). Here is a plot of the function sin(x^{2} + y^{2}):
plotfunc3d(sin(x^2 + y^2), x = -2..2, y = -2..2):
If several functions are to be plotted in the same graphical scene, just pass a sequence of function expressions; all functions are plotted over the specified common range:
plotfunc3d((x^2 + y^2)/4, sin(x - y)/(x - y), x = -2..2, y = -2..2):
Functions that do not allow a simple symbolic representation
by an expression can also be defined by a procedure
that produces
a numerical value f(x, y) when
called with numerical values x, y from
the plot range. In the following example we consider the largest eigenvalue
of a symmetric 3×3 matrix
that contains two parameters x, y.
We plot this eigenvalue as a function of x and y:
f := (x, y) -> max(numeric::eigenvalues( matrix([[-y, x, -x], [x, y, x], [-x, x, y^2]]))): plotfunc3d(f, x = -1..1, y = -1..1):
The names x, y used
in the specification of the plotting range provide the labels of the
corresponding axes. Functions can also be defined by piecewise
objects:
plotfunc3d(piecewise([x < y, y - x], [x > y, (y - x)^2]), x = 0..1, y = 0..1)
Note that there are gaps in the definition of the function above:
no function value is specified for x = y.
This does not cause any problem, because plotfunc3d
simply
ignores points that do not produce real numerical values if it finds
suitable values in the neighborhood. Thus, missing points do not show
up in a plot if these points are isolated or are restricted to some
1-dimensional curve in the x-y plane.
If the function is not real valued in regions of nonzero measure,
the resulting plot contains holes. The following function is real
valued only in the disk x^{2} + y^{2} ≤
1:
plotfunc3d(sqrt(1 - x^2 - y^2), x = 0..1, y = 0..1):
When several functions are plotted in the same scene, they are
drawn in different colors that are chosen automatically. With the Colors
attribute
one may specify a list of RGB colors
that plotfunc3d
shall
use:
plotfunc3d(2 + x^2 + y^2, 1 + x^4 + y^4, x^6 + y^6, x = -1..1, y = -1..1, Colors = [RGB::Red, RGB::Green, RGB::Blue]):
Animated 3D plots of functions are created by passing function expressions depending on two variables (x, y, say) and an animation parameter (a, say) and specifying a range for x, y, and a:
plotfunc3d(x^a + y^a, x = 0..2, y = 0..2, a = 1..2):
Once the plot is created, the first frame of the picture appears as a static plot. After double-clicking on the picture, the animation starts. The usual controls for stopping, going to some other point in time etc. are available.
The default number of frames of the animation is 50.
If a different value is desired, just pass the attribute Frames
= n
, where n is
the number of frames that shall be created:
plotfunc3d(sin(a)*sin(x) + cos(a)*cos(y), x = 0..2*PI, y = 0..2*PI, a = 0..2*PI, Frames = 32):
Apart from the color specification or the Frames
number, there
is a large number of further attributes that may be passed to plotfunc3d
. Each attribute
is passed as an equation AttributeName = AttributeValue
to plotfunc3d
. Here, we
only present some selected attributes. Section Attributes for plotfunc2d and
plotfunc3d provides further tables with more attributes.
plotfunc3d
attribute name | possible values/example | meaning | default |
---|---|---|---|
Height | 8*unit::cm | physical height of the picture | 80*unit::mm |
Width | 12*unit::cm | physical width of the picture | 120*unit::mm |
Footer | string | footer text | "" (no footer) |
Header | string | header text | "" (no header) |
Title | string | title text | "" (no title) |
TitlePosition | [ real value, real value] | coordinates of the lower left corner of the title | |
GridVisible | TRUE , FALSE | visibility of "major" grid lines in all directions | FALSE |
SubgridVisible | TRUE , FALSE | visibility of "minor" grid lines in all directions | FALSE |
AdaptiveMesh | integer ≥ 0 | depth of the adaptive mesh | 0 |
Axes | Automatic , Boxed , Frame , Origin | axes type | Boxed |
AxesVisible | TRUE , FALSE | visibility of all axes | TRUE |
AxesTitles | [string, string, string] | titles of the axes | ["x","y","z"] |
Colors | list of RGB values | fill colors | |
Frames | integer ≥ 0 | number of frames of the animation | 50 |
LegendVisible | TRUE , FALSE | legend on/off | TRUE |
FillColorType | Dichromatic , Flat , Functional ,
Monochrome , Rainbow | color scheme | Dichromatic |
Mesh | [integer ≥ 2, integer ≥ 2] | number of "major" mesh points | [25, 25] |
Submesh | [integer ≥ 0, integer ≥ 0] | number of "minor" mesh points | [0, 0] |
Scaling | Automatic , Constrained , Unconstrained | scaling mode | Unconstrained |
TicksNumber | None , Low , Normal , High | number of labeled ticks at all axes | Normal |
ViewingBoxZRange | zmin..zmax | restricted viewing range in z direction | Automatic |
ZRange | zmin..zmax | restricted viewing range in z direction
(equivalent to ViewingBoxZRange )
| Automatic |
In the following example, the default mesh of 25
×25 sample points used by plotfunc3d
does not
suffice to create a sufficiently resolved plot:
plotfunc3d(sin(x^2 + y^2), x = -3..3, y = -3..3):
We increase the number of numerical mesh points via the Submesh
attribute:
plotfunc3d(sin(x^2 + y^2), x = -3..3, y = -3..3, Submesh = [3, 3])
The following call specifies a header via Header =
"The function sin(x - y^2)"
. Grid lines attached to the
ticks are "switched on" by GridVisible = TRUE
and SubgridVisible
= TRUE
:
plotfunc3d(sin(x - y^2), x = -2*PI..2*PI, y = -2..2, Header = "The function sin(x - y^2)", GridVisible = TRUE, SubgridVisible = TRUE):
When singularities are found in the function, an automatic clipping is called trying to restrict the vertical viewing range in some way to obtain a "reasonably" scaled picture. This is a heuristic approach that sometimes needs a helping adaptation "by hand". In the following example, the automatically chosen range between z ≈ 0 and z ≈ 0.8 in vertical direction is suitable to represent the pole at x = 1, y = 1, but it does not provide a good resolution of the pole at x = - 1, y = 1:
plotfunc3d(1/((x + 1)^2 + (y - 1)^2)/((x - 1)^2 + (y - 1)^2)^5, x = -2..3, y = -2..3, Submesh = [3, 3]):
There is no good viewing range that is adequate for both poles
because they are of different order. We override the automatic viewing
range suggested by plotfunc3d
and
request a specific viewing range in the vertical direction via ViewingBoxZRange
:
plotfunc3d(1/((x + 1)^2 + (y - 1)^2)/((x - 1)^2 + (y - 1)^2)^5, x = -2..3, y = -2..3, Submesh = [3, 3], ViewingBoxZRange = 0..0.1):
The values of the following function have a lower bound but
no upper bound. We use the attribute ViewingBoxZRange = Automatic..20
to
let plotfunc2d
find
a lower bound for the viewing box by itself whilst requesting a specific
value of 20 for the upper
bound:
plotfunc3d(1/x^2/y^2 + exp(-x)*sin(PI*y), x = -2..2, y = -2..2, ViewingBoxZRange = Automatic..20):
plotfunc2d
and plotfunc3d
The function plotters plotfunc2d
and plotfunc3d
accept
a large number of attributes (options). In this section we give an
overview over the most important attributes. There is a help page
for each attribute that provides more detailed information and examples.
Attributes are passed as equations AttributeName =
AttributeValue
to plotfunc2d
and plotfunc3d
. Several
attributes can be passed simultaneously as a sequence of such equations.
The attributes can be changed interactively in the property
inspector. Click on the plot to make subwindows appear for the "object
browser" and the "property inspector" (see section Viewer, Browser, and Inspector:
Interactive Manipulation). The functions plotted by plotfunc2d
and plotfunc3d
appear as
plot objects of type plot::Function2d
and plot::Function3d
, respectively.
They are embedded in a coordinate system inside a graphical scene.
The scene is embedded in a viewing area called the ‘Canvas.'
In the viewer, the various plot attributes are associated with the
different objects of this graphical hierarchy. Typically, layout parameters
and titles are set within the canvas, whilst axes, grid lines, viewing
boxes etc. are associated with the coordinate system. Some attributes
such as colors, line width, the numerical mesh size etc. belong to
the function graphs and can be set separately for each function plotted
by plotfunc2d
/plotfunc3d
.
The last entry in the following tables provides the location
of the attribute in the graphical hierarchy of the object browser.
For example, for changing the background color of the picture, select
the scene by double clicking the ‘Scene2d'/‘Scene3d'
entry in the object browser. Now, the property inspector provides
a tree of attributes with the nodes ‘Annotation,' ‘Layout,'
and ‘Style.' Opening the ‘Style' sub-tree,
one finds an entry for BackgroundColor
which allows to change
the background color interactively.
Here is a table of the most important attributes for setting the layout and the background of the picture:
Attributes for Layout
attribute name | possible values/example | meaning | default | browser entry |
---|---|---|---|---|
Width | 12*unit::cm | physical width of the picture | 120*unit::mm | Canvas |
Height | 8*unit::cm | physical height of the picture | 80*unit::mm | Canvas |
BackgroundColor | RGB color | color of the background | RGB::White | Scene2d/3d |
BorderColor | RGB color | color of the border | RGB::Grey50 | Scene2d/3d |
BorderWidth | 1*unit::mm | width of the border | 0 | Scene2d/3d |
Margin | 1*unit::mm | common width for all margins:
BottomMargin ,
LeftMargin , etc.
| 1*unit::mm | Scene2d/3d |
BottomMargin | 1*unit::mm | width of bottom margin | 1*unit::mm | Scene2d/3d |
LeftMargin | 1*unit::mm | width of left margin | 1*unit::mm | Scene2d/3d |
RightMargin | 1*unit::mm | width of right margin | 1*unit::mm | Scene2d/3d |
TopMargin | 1*unit::mm | width of top margin | 1*unit::mm | Scene2d/3d |
BackgroundStyle | Flat , LeftRight , TopBottom , Pyramid | background style of 3D scenes | Flat | Scene3d |
BackgroundColor2 | RGB color | secondary color of the background (used for color blends) | RGB::Grey75 | Scene3d |
BackgroundTransparent | TRUE , FALSE | transparent background? | FALSE | Scene2d |
An overall title can be set as a footer and/or a header. Here is a table of the attributes determining the footer and/or header of the picture:
Attributes for Footer and Header
attribute name | possible values/example | meaning | default | browser entry |
---|---|---|---|---|
Footer | string | footer text | "" (no footer)
| Scene2d/3d |
Header | string | header text | "" (no header)
| Scene2d/3d |
FooterAlignment | Left , Center , Right | horizontal alignment | Center | Scene2d/3d |
HeaderAlignment | Left , Center , Right | horizontal alignment | Center | Scene2d/3d |
FooterFont | see section Fonts | font for the footer | sans-serif 12 | Scene2d/3d |
HeaderFont | see section Fonts | font for the header | sans-serif 12 | Scene2d/3d |
Apart from footers and/or headers of scenes and canvas, there
are titles associated with the functions. In contrast to footer and
header, function titles can be placed anywhere in the coordinate system
via the attribute TitlePosition
. Typically, titles
are associated with individual objects rather than with entire scenes.
Thus, when using plotfunc2d
or plotfunc3d
, a title
attribute will usually only be used when a single function is displayed.
However, several titles with separate positions can be set interactively
in the property inspector for each of the functions:
Attributes for Titles
attribute name | possible values/example | meaning | default | browser entry |
---|---|---|---|---|
Title | string | title text | "" (no title)
| Function2d/3d |
TitlePosition | [ real value, real value] | coordinates of the lower left corner of the title | Function2d | |
TitlePosition | [ real value,real value,real value] | coordinates of the lower left corner of the title | Function3d | |
TitlePositionX | real value | x coordinate of the lower left corner of the title | Function2d/3d | |
TitlePositionY | real value | y coordinate of the lower left corner of the title | Function2d/3d | |
TitlePositionZ | real value | z coordinate of the lower left corner of the title | Function3d | |
TitleFont | see section Fonts | font for the titles | sans-serif 11 | Function2d/3d |
If several functions are drawn simultaneously in one picture,
it is useful to display a legend indicating which color is used for
which function. See section Legends for
further details on legends. Here is a table of the most important
attributes determining the form of the legend. The attributes LegendEntry
, LegendText
,
and LegendVisible = TRUE
are set automatically
by plotfunc2d
/plotfunc3d
if more than
one function is plotted. The property inspector (Viewer, Browser, and Inspector:
Interactive Manipulation) allows to reset the legend entry
for each function:
Attributes for Legend
attribute name | possible values/example | meaning | default | browser entry |
---|---|---|---|---|
LegendEntry | TRUE , FALSE | add this function to the legend? | TRUE | Function2d/3d |
LegendText | string | legend text | Function2d/3d | |
LegendVisible | TRUE , FALSE | legend on/off | TRUE | Scene2d/3d |
LegendPlacement | Top , Bottom | vertical placement | Bottom | Scene2d/3d |
LegendAlignment | Left , Center , Right | horizontal alignment | Center | Scene2d/3d |
LegendFont | see section Fonts | font for the legend text | sans-serif 8 | Scene2d/3d |
When singular functions are plotted, it is often useful to request
a specific viewing range. Here is a table of the most important attributes
for setting viewing ranges. In the interactive object browser, you
will find them under CoordinateSystem2d
(CS2d
)
and CoordinateSystem3d
(CS3d
),
respectively:
Attributes for Viewing Ranges
attribute name | possible values/example | meaning | default | browser entry |
---|---|---|---|---|
ViewingBox | [xmin..xmax, ymin..ymax] ,
[Automatic, Automatic] | viewing range in x and y direction | [Automatic, Automatic] | CS2d |
ViewingBox | [xmin..xmax, ymin..ymax, zmin..zmax] ,
[Automatic, Automatic, Automatic] | viewing range in x, y, z direction | [Automatic, Automatic, Automatic] | CS3d |
ViewingBoxXRange | xmin..xmax | viewing range in x direction | Automatic.. Automatic | CS2d/3d |
ViewingBoxYRange | ymin..ymax | viewing range in y direction | Automatic.. Automatic | CS2d/3d |
ViewingBoxZRange | zmin..zmax | viewing range in z direction | Automatic.. Automatic | CS3d |
ViewingBoxXMin | xmin : real value or Automatic | lowest viewing value in x direction | Automatic | CS2d/3d |
ViewingBoxXMax | xmax : real value or Automatic | highest viewing value in x direction | Automatic | CS2d/3d |
ViewingBoxYMin | ymin : real value or Automatic | lowest viewing value in y direction | Automatic | CS2d/3d |
ViewingBoxYMax | ymax : real value or Automatic | highest viewing value in y direction | Automatic | CS2d/3d |
ViewingBoxZMin | zmin : real value or Automatic | lowest viewing value in z direction | Automatic | CS3d |
ViewingBoxZMax | zmax : real value or Automatic | highest viewing value in z direction | Automatic | CS3d |
In contrast to the routines of the plot
library, plotfunc2d
and plotfunc3d
also accept
the attributes YMin
, YMax
, YRange
and ZMin
, ZMax
, ZRange
, respectively,
as shortcuts for the somewhat clumsy attribute names ViewingBoxYMin
etc.
E.g.,
plotfunc2d(f(x), x = xmin..xmax, YRange = ymin..ymax)
is equivalent to
plotfunc2d(f(x), x = xmin..xmax, ViewingBoxYRange = ymin..ymax)
and
plotfunc3d(f(x, y), x = xmin..xmax, y = ymin..ymax, ZRange = zmin..zmax)
is equivalent to
plotfunc3d(f(x, y), x = xmin..xmax, y = ymin..ymax, ViewingBoxZRange = zmin..zmax)
Here is a table of the most important attributes for arranging
coordinate axes. In the interactive object browser, you will find
them under CoordinateSystem2d
(CS2d
)
and CoordinateSystem3d
(CS3d
),
respectively:
Attributes for Axes
attribute name | possible values/example | meaning | default | browser entry |
---|---|---|---|---|
Axes | Automatic , Boxed , Frame , Origin | axes type | Automatic | CS2d/3d |
AxesVisible | TRUE , FALSE | visibility of all axes | TRUE | CS2d/3d |
XAxisVisible | TRUE , FALSE | visibility of the x axis | TRUE | CS2d/3d |
YAxisVisible | TRUE , FALSE | visibility of the y axis | TRUE | CS2d/3d |
ZAxisVisible | TRUE , FALSE | visibility of the z axis | TRUE | CS3d |
AxesTitles | [string, string] | titles of the axes (2D) | ["x","y"] | CS2d |
AxesTitles | [string, string, string] | titles of the axes (3D) | ["x","y","z"] | CS3d |
XAxisTitle | string | title of the x axis | "x" | CS2d/3d |
YAxisTitle | string | title of the y axis | "y" | CS2d/3d |
ZAxisTitle | string | title of the z axis | "z" | CS3d |
AxesTitleAlignment | Begin , Center , End | alignment for all axes titles | End | CS2d |
AxesTitleAlignment | Begin , Center , End | alignment for all axes titles | Center | CS3d |
XAxisTitleAlignment | Begin , Center , End | alignment for the x axis title | End | CS2d |
XAxisTitleAlignment | Begin , Center , End | alignment for the x axis title | Center | CS3d |
YAxisTitleAlignment | Begin , Center , End | alignment for the y axis title | End | CS2d |
YAxisTitleAlignment | Begin , Center , End | alignment for the y axis title | Center | CS3d |
ZAxisTitleAlignment | Begin , Center , End | alignment for the z axis title | Center | CS3d |
YAxisTitleOrientation | Vertical , Horizontal | orientation of the y axis title | Horizontal | CS2d |
AxesTips | TRUE , FALSE | axes with tips? | TRUE | CS2d/3d |
AxesOrigin | [ real value, real value] | crosspoint of the axes (2D) | [0, 0] | CS2d |
AxesOrigin | [ real value,real value, real value] | crosspoint of the axes (3D) | [0, 0, 0] | CS3d |
AxesOriginX | real value | x value
of AxesOrigin | 0 | CS2d/3d |
AxesOriginY | real value | y value
of AxesOrigin | 0 | CS2d/3d |
AxesOriginZ | real value | z value
of AxesOrigin | 0 | CS3d |
AxesLineColor | RGB color | color of the axes | RGB::Black | CS2d/3d |
AxesLineWidth | 0.18*unit::mm | physical width of the axes lines | 0.18*unit::mm | CS2d/3d |
AxesInFront | TRUE , FALSE | axes in front of the objects? | FALSE | CS2d |
AxesTitleFont | see section Fonts | font for the axes titles | sans-serif 10 | CS2d/3d |
Here is a table of the most important attributes for setting
tick marks and tick labels along the axes. In the interactive object
browser, you will find them under CoordinateSystem2d
(CS2d
)
and CoordinateSystem3d
(CS3d
),
respectively:
Attributes for Tick Marks and Tick Labels
attribute name | possible values/example | meaning | default | browser entry |
---|---|---|---|---|
TicksVisible | TRUE , FALSE | visibility of ticks along all axes | TRUE | CS2d/3d |
XTicksVisible | TRUE , FALSE | visibility of ticks along the x axis | TRUE | CS2d/3d |
YTicksVisible | TRUE , FALSE | visibility of ticks along the y axis | TRUE | CS2d/3d |
ZTicksVisible | TRUE , FALSE | visibility of ticks along the z axis | TRUE | CS3d |
TicksDistance | positive real value | distance between labeled ticks along all axes | CS2d/3d | |
XTicksDistance | positive real value | distance between labeled ticks along the x axis | CS2d/3d | |
YTicksDistance | positive real value | distance between labeled ticks along the y axis | CS2d/3d | |
ZTicksDistance | positive real value | distance between labeled ticks along the z axis | CS3d | |
TicksAnchor | real value | the position of a labeled tick to start with | 0 | CS2d/3d |
XTicksAnchor | real value | the position of a labeled tick to start with | 0 | CS2d/3d |
YTicksAnchor | real value | the position of a labeled tick to start with | 0 | CS2d/3d |
ZTicksAnchor | real value | the position of a labeled tick to start with | 0 | CS3d |
TicksNumber | None , Low , Normal , High | number of labeled ticks along all axes | Normal | CS2d/3d |
XTicksNumber | None , Low , Normal , High | number of labeled ticks along the x axis | Normal | CS2d/3d |
YTicksNumber | None , Low , Normal , High | number of labeled ticks along the y axis | Normal | CS2d/3d |
ZTicksNumber | None , Low , Normal , High | number of labeled ticks along the z axis | Normal | CS3d |
TicksBetween | integer ≥ 0 | number of smaller unlabeled ticks between labeled ticks along all axes | 1 | CS2d/3d |
XTicksBetween | integer ≥ 0 | number of smaller unlabeled ticks between labeled ticks along the x axis | 1 | CS2d/3d |
YTicksBetween | integer ≥ 0 | number of smaller unlabeled ticks between labeled ticks along the y axis | 1 | CS2d/3d |
ZTicksBetween | integer ≥ 0 | number of smaller unlabeled ticks between labeled ticks along the z axis | 1 | CS3d |
TicksLabelStyle | Diagonal , Horizontal ,
Shifted ,
Vertical | orientation and style of tick labels along all axes | Horizontal | CS2d/3d |
XTicksLabelStyle | Diagonal , Horizontal ,
Shifted ,
Vertical | orientation and style of tick labels along the x axes | Horizontal | CS2d/3d |
YTicksLabelStyle | Diagonal , Horizontal ,
Shifted ,
Vertical | orientation and style of tick labels along the y axis | Horizontal | CS2d/3d |
ZTicksLabelStyle | Diagonal , Horizontal ,
Shifted ,
Vertical | orientation and style of tick labels along the z axis | Horizontal | CS3d |
TicksAt | [tick1, tick2, ...] ,
where tick.i is a real
value (the position) or an
equation position = "label string"
(such as 3.14 = "pi" )
| ticks set by the user, valid for all axes | CS2d/3d | |
XTicksAt | see TicksAt | ticks along the x axis set by the user | CS2d/3d | |
YTicksAt | see TicksAt | ticks along the y axis set by the user | CS2d/3d | |
ZTicksAt | see TicksAt | ticks along the z axis set by the user | CS3d | |
TicksLength | 2*unit::mm | length of the tick marks | 2*unit::mm | CS2d |
TicksLabelFont | see section Fonts | font for all axes titles | sans-serif 8 | CS2d/3d |
Coordinate grid lines can be drawn in the background of a graphical
scene (corresponding to the rulings of lined paper). They are attached
to the tick marks along the axes. There are grid lines attached to
the "major" labeled tick marks which are referred to
as the "Grid
." There are also grid
lines associated with the "minor" unlabeled tick marks
set be the attribute TicksBetween
. These "minor"
grid lines are referred to as the "Subgrid
."
The two kinds of grid lines can be set independently. In the interactive
object browser, you will find the following attributes under CoordinateSystem2d
(CS2d
)
and CoordinateSystem3d
(CS3d
),
respectively:
Attributes for Grid Lines
attribute name | possible values/example | meaning | default | browser entry |
---|---|---|---|---|
GridVisible | TRUE , FALSE | visibility of "major" grid lines in all directions | FALSE | CS2d/3d |
SubgridVisible | TRUE , FALSE | visibility of "minor" grid lines in all directions | FALSE | CS2d/3d |
XGridVisible | TRUE , FALSE | visibility of "major" grid lines in x direction | FALSE | CS2d/3d |
XSubgridVisible | TRUE , FALSE | visibility of "minor" grid lines in x direction | FALSE | CS2d/3d |
YGridVisible | TRUE , FALSE | visibility of "major" grid lines in y direction | FALSE | CS2d/3d |
YSubgridVisible | TRUE , FALSE | visibility of "minor" grid lines in y direction | FALSE | CS2d/3d |
ZGridVisible | TRUE , FALSE | visibility of "major" grid lines in z direction | FALSE | CS3d |
ZSubgridVisible | TRUE , FALSE | visibility of "minor" grid lines in z direction | FALSE | CS3d |
GridLineColor | RGB color | color of all "major" grid lines | RGB::Grey75 | CS2d/3d |
SubgridLineColor | RGB color | color of all "minor" grid lines | RGB::Grey | CS2d/3d |
GridLineWidth | 0.1*unit::mm | width of all "major" grid lines | 0.1*unit::mm | CS2d/3d |
SubgridLineWidth | 0.1*unit::mm | width of all "minor" grid lines | 0.1*unit::mm | CS2d/3d |
GridLineStyle | Dashed , Dotted , Solid | drawing style of all "major" grid lines | Solid | CS2d/3d |
SubgridLineStyle | Dashed , Dotted , Solid | drawing style of all "minor" grid lines | Solid | CS2d/3d |
GridInFront | TRUE , FALSE | grid lines in front of all objects? | FALSE | CS2d |
Animations require that plotting ranges x = xmin..xmax
(and y
= ymin..ymax
) are fully specified in plotfunc2d
(or plotfunc3d
, respectively). Animations
are triggered by passing an additional range such as a =
amin..amax
to plotfunc2d
/plotfunc3d
. The animation
parameter a
may turn up in the expression of the
functions that are to be plotted as well as in various other places
such as the coordinates of titles etc. See section Graphics and Animations for details.
Attributes for Animations
attribute name | possible values/example | meaning | default | browser entry |
---|---|---|---|---|
Frames | integer ≥ 0 | number of frames of the animation | 50 | Function2d/3d |
ParameterName | symbolic name | name of the animation parameter | Function2d/3d | |
ParameterRange | amin..amax | range of the animation parameter | Function2d/3d | |
ParameterBegin | amin : real value
| lowest value of the animation parameter | Function2d/3d | |
ParameterEnd | amax : real value
| highest value of the animation parameter | Function2d/3d | |
TimeRange | start..end | physical time range for the animation | 0..10 | Function2d/3d |
TimeBegin | start : real value
| physical time when the animation begins | 0 | Function2d/3d |
TimeEnd | end : real value
| physical time when the animation ends | 10 | Function2d/3d |
VisibleBefore | real value | physical time when the object becomes invisible | Function2d/3d | |
VisibleAfter | real value | physical time when the object becomes visible | Function2d/3d | |
VisibleFromTo | range of real values | physical time range when the object is visible | Function2d/3d | |
VisibleBeforeBegin | TRUE , FALSE | visible before animation begins? | TRUE | Function2d/3d |
VisibleAfterEnd | TRUE , FALSE | visible after animation ends? | TRUE | Function2d/3d |
Functions are plotted as polygons consisting of straight line segments between points of the "numerical mesh." The number of points in this numerical mesh are set by various "mesh" attributes:
Attributes for Numerical Mesh
attribute name | possible values/example | meaning | default | browser entry |
---|---|---|---|---|
Mesh | integer ≥ 2 | number of "major" mesh points in x direction.
The same as XMesh .
| 121 | Function2d |
Mesh | [ integer ≥ 2,
integer ≥ 2] | number of "major" mesh points in x and y direction.
Corresponds to XMesh , YMesh .
| [25,25] | Function3d |
Submesh | integer ≥ 0 | number of "minor" mesh points between the "major"
mesh points set by Mesh .
The same as XSubmesh .
| 0 | Function2d |
Submesh | [ integer ≥ 0,
integer ≥ 0] | number of "minor" mesh points between the "major"
mesh points set by Mesh .
Corresponds to XSubmesh , YSubmesh .
| [0, 0] | Function3d |
XMesh | integer ≥ 2 | number of "major" mesh points in the x direction | 121 | Function2d |
XMesh | integer ≥ 2 | number of "major" mesh points in the x direction | 25 | Function3d |
XSubmesh | integer ≥ 0 | number of "minor" mesh points between the "major"
mesh points set by XMesh | 0 | Function2d/3d |
YMesh | integer ≥ 2 | number of "major" mesh points in the y direction | 121 | Function2d |
YMesh | integer ≥ 2 | number of "major" mesh points in the y direction | 25 | Function3d |
YSubmesh | integer ≥ 0 | number of "minor" mesh points between the "major"
mesh points set by YMesh | 0 | Function3d |
AdaptiveMesh | integer ≥ 0 | depth of the adaptive mesh | 2 | Function2d |
AdaptiveMesh | integer ≥ 0 | depth of the adaptive mesh | 0 | Function3d |
In 2D pictures generated by plotfunc2d
, singularities of a function
are indicated by vertical lines ("vertical asymptotes"),
unless DiscontinuitySearch = FALSE
is set. Here
is a table with the attributes for setting the style of the vertical
asymptotes:
Attributes for Vertical Asymptotes
attribute name | possible values/example | meaning | default | browser entry |
---|---|---|---|---|
VerticalAsymptotesVisible | TRUE , FALSE | visibility | TRUE | Function2d |
VerticalAsymptotesColor | RGB color | color | RGB::Grey50 | Function2d |
VerticalAsymptotesStyle | Dashed , Dotted , Solid | drawing style | Dashed | Function2d |
VerticalAsymptotesWidth | 0.2*unit::mm | physical width | 0.2*unit::mm | Function2d |
The colors of the functions plotted by plotfunc2d
are chosen automatically.
The property inspector (see section Viewer, Browser, and Inspector:
Interactive Manipulation) allows to change these attributes:
Attributes for Lines
attribute name | possible values/example | meaning | default | browser entry |
---|---|---|---|---|
LinesVisible | TRUE , FALSE | visibility of lines (switch this function on/off) | TRUE | Function2d |
LineWidth | 0.2*unit::mm | physical line width | 0.2*unit::mm | Function2d |
LineColor | RGB color | color | Function2d | |
LineColor2 | RGB color | Function2d | ||
LineStyle | Dashed , Dotted , Solid | drawing style of line objects | Solid | Function2d |
LineColorType | Dichromatic , Flat , Functional ,
Monochrome , Rainbow | color scheme for lines | Flat | Function2d |
LineColorFunction | procedure | user defined coloring | Function2d |
Setting LinesVisible = FALSE
and PointsVisible
= TRUE
, the functions plotted by plotfunc2d
will not be displayed as polygons
but as sequences of points. Here is a table of the attributes to set
the presentation style of points:
Attributes for Points
attribute name | possible values/example | meaning | default | browser entry |
---|---|---|---|---|
PointsVisible | TRUE , FALSE | visibility of points | FALSE | Function2d |
PointSize | 1.5*unit::mm | physical size of points | 1.5*unit::mm | Function2d |
PointStyle | Circles , Crosses , Diamonds ,
FilledCircles , FilledDiamonds ,
FilledSquares , Squares , Stars ,
XCrosses | presentation style of points | FilledCircles | Function2d |
The colors and surface styles of the functions plotted by plotfunc3d
are chosen
automatically. The property inspector (see section Viewer, Browser, and Inspector:
Interactive Manipulation) allows to the change these attributes:
Attributes for Surface Style of 3-D Function Graphs
attribute name | possible values/example | meaning | default | browser entry |
---|---|---|---|---|
Filled | TRUE , FALSE | display as a surface or as a wireframe model? | TRUE | Function3d |
FillColor | RGB or RGBa color | main color (for flat coloring) | Function3d | |
FillColor2 | RGB or RGBa color | secondary color (for Dichromatic and
Monochrome coloring)
| Function3d | |
FillColorType | Dichromatic , Flat , Functional ,
Monochrome , Rainbow | color scheme | Dichromatic | Function3d |
FillColorFunction | procedure | user defined coloring | Function3d | |
Shading | Smooth , Flat | smooth or flat shading? | Smooth | Function3d |
XLinesVisible | TRUE , FALSE | visibility of x parameter lines | TRUE | Function3d |
YLinesVisible | TRUE , FALSE | visibility of y parameter lines | TRUE | Function3d |
MeshVisible | TRUE , FALSE | visibility of the internal triangulation | FALSE | Function3d |
LineWidth | 0.35*unit::mm | physical line width | 0.35*unit::mm | Function3d |
LineColor | RGB or RGBa color | color of parameter lines | RGB::Black.[0.25] | Function3d |
Besides the usual linear plots, logarithmic plots are also possible
by choosing an appropriate CoordinateType
.
With Scaling = Constrained
, the unit box
in model coordinates (a square in 2D, a cube in 3D) is displayed as
a unit box. With Scaling = Unconstrained
, the renderer
applies different scaling transformation in the coordinate directions
to obtain an optimal fit of the picture in the display window. This,
however, may distort a circle to an ellipse. With Scaling
= Constrained
a 2D circle appears on the screen like a circle,
a 3D sphere appears like a sphere.
2D functions are preprocessed by a semi-symbolic search for
discontinuities to improve the graphical representation near singularities
and to avoid graphical artifacts. If continuous functions are plotted,
one may gain some speed up by switching off this search with DiscontinuitySearch
= FALSE
.
When very time consuming plots are to be created, it may be
useful to create the plots in "batch mode." With the
attribute OutputFile = filename
, the graphical
output is not rendered to the screen. An external file with the specified
name containing the graphical data is created instead. It may contain
xml data that may be viewed later by opening the file with the MuPAD^{®} graphics
tool ‘VCam.' Alternatively, bitmap files in various
standard bitmap formats such as bmp, jpg etc. can be created that
may be viewed by other standard tools. See section Batch Mode for further details.
Various Attributes
attribute name | possible values/example | meaning | default | browser entry |
---|---|---|---|---|
CoordinateType | LinLin , LinLog , LogLin , LogLog | linear-linear, linear-logarithmic, logarithmic-linear, log-log | LinLin | Coord.Sys.2d |
CoordinateType | LinLinLin , ... , LogLogLog | linear-linear-linear, …, log-log-log | LinLinLin | Coord.Sys.3d |
Scaling | Automatic , Constrained , Unconstrained | scaling mode | Unconstrained | Coord.Sys.2d/3d |
YXRatio | positive real value | aspect ratio y : x
(only for Scaling = Unconstrained )
| 1 | Scene2d/3d |
ZXRatio | positive real value | aspect ratio z : x
(only for Scaling = Unconstrained )
| 2/3 | Scene3d |
DiscontinuitySearch | TRUE , FALSE | enable/disable semi-symbolic search for discontinuities | TRUE | Function2d |
OutputFile | string | save the plot data in a file |