Typesetting in Plots - Maple Programming Help

Typesetting in Plots

 This help page describes how you can include typeset text and mathematics in a plot.

Availability

 • Typeset text and mathematics can appear anywhere in a 2-D or 3-D plot where text is normally allowed.  This includes text provided by the plots[textplot] command and the following options: annotation, caption, labels, legend, tickmarks, and title.  For more information on how to use these options, see the Examples section of this help page.

Specifying Typeset Text and Math

 • Arbitrary expressions may be provided to the plots[textplot] command or as values for the options listed above.  These expressions are displayed on the plot as typeset output whenever possible.  Strings are displayed as plain text without the quotation marks, but names such as x, y and Pi are typeset.
 • If you are using 2-D input mode, then you can take advantage of the different methods available in Maple for inserting 2-D math.  For example, if you wish to add the option $\mathrm{title}={\int }_{0}^{t}f\left(x\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}ⅆx$, simply click on the definite integral template from the Expressions palette as the right-hand side of the title option and fill in the placeholders.
 When using 2-D input mode, the input must parse to a Maple expression. If you wish to create a title consisting of palette entries that cannot be parsed, you must create an atomic variable from them.  This can be done by using left single quotes, as described on the help page for names, or by using the context menu (2-D Math-> Convert To -> Atomic Variable).
 To avoid simplification or evaluation of expressions that you wish to typeset, you can create atomic variables as described above or use unevaluation quotes (see uneval).
 • To concatenate several expressions, wrap them inside a typeset structure.  For example, you can combine math and text with the option, caption=typeset("A plot of ", x^2/(x+5), "."). Alternatively, you can provide a format string containing format codes of the form %$n$, where $n$ is a non-negative integer. The format code %$n$ is replaced by the $n$-th argument following the format string. The format code %0 is replaced by all the arguments.

Notes

 • Typesetting is not available for the Classic Worksheet interface.  (See plot/interface.)  However, math expressions, including those inside a typeset structure, may still be provided wherever text is accepted.  In these cases, the expressions are first converted to plain text and then concatenated.
 • Strings are displayed without the quotation marks.  To include a quotation mark in a string, use \".  To create multiple lines of text, use \n.  See backslash for more information about using the backslash as an escape character.

Examples

 > $\mathrm{plot}\left(\frac{{x}^{2}}{x+5},x=1..5,\mathrm{caption}=\mathrm{typeset}\left("A plot of",\frac{{x}^{2}}{x+5},"."\right)\right)$
 > $\mathrm{plot}\left(\left[0.2{x}^{3}-x,\frac{{x}^{2}}{x+5}\right],x=1..3,\mathrm{caption}=\mathrm{typeset}\left("A plot of %1 and %2.",0.2{x}^{3}-x,\frac{{x}^{2}}{x+5}\right)\right)$
 > $\mathrm{plot}\left(\mathrm{sin}\left(x\right),x=-4\mathrm{Pi}..4\mathrm{Pi},\mathrm{tickmarks}=\left[\mathrm{spacing}\left(\mathrm{Pi}\right),\mathrm{default}\right]\right)$
 > $\mathrm{plot}\left(\left[{\mathrm{cos}\left(x\right)}^{2},1-\frac{1x}{2}\right],x=-\mathrm{Pi}..\mathrm{Pi},\mathrm{legend}=\left[\mathrm{typeset}\left("Curve:",{\mathrm{cos}\left(x\right)}^{2}\right),\mathrm{typeset}\left("Curve:",1-\frac{1x}{2}\right)\right]\right)$
 > ${\mathrm{plots}}_{\mathrm{textplot}}\left(\left[1,1,\mathrm{typeset}\left("The plot of",{∫}_{{t}_{0}}^{t}f\left(x\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}ⅆx,"."\right),\mathrm{font}=\left[\mathrm{TIMES},\mathrm{BOLD},20\right]\right]\right)$

With the following example, place the pointer over each curve to see the annotations.

 > $\mathrm{plot}\left(\left[\mathrm{sin}\left(x\right),\mathrm{cos}\left(x\right)\right],\mathrm{annotation}=\left[\mathrm{typeset}\left("The function",\mathrm{sin}\left(x\right)\right),\mathrm{typeset}\left("The derivative of",\mathrm{sin}\left(x\right)\right)\right]\right)$

Compatibility

 • The caption option was updated in Maple 15.