annotation - Maple Help

Home : Support : Online Help : Graphics : 2-D : Options : annotation

Plot Annotations

 Calling Sequence plotcommand(plotargs, annotation=t) plotcommand(plotargs, annotation=A)

Parameters

 plotargs - arguments to a plotting command t - an annotation A - an Array of annotations

Summary

 • Use the annotation option to add descriptive text that appears when the pointer hovers over a curve or a point.
 > plot(sin(x), x=0..2*Pi, annotation="a sine curve");

The annotation Option

 • The annotation option allows you to add descriptive text to a 2-D curve or point plot. The term "point plot" in this context means a collection of points that are treated as a single plot element, such as that created by the plots:-pointplot or dataplot command.  The text, which can include mathematical expressions, appears when the pointer hovers over the plot element to which it is associated.
 • In the first calling sequence, t can be any Maple expression that can be typeset. See the plot/typesetting help page for more information about how such expressions can be specified. In this case, t is displayed whenever the pointer hovers over any part of the curve or point plot.
 • In the second calling sequence, A is an Array of $n$ values, where $n$ is the number of points defining a curve or in a single point plot. This form of the option does not work with curves consisting of disconnected parts, such as those formed using the discont option or the plots:-implicitplot command.

Including Coordinate Values

 • You can include the x-coordinate or y-coordinate associated with the location over which the pointer hovers in an annotation. To do this, use the name xcoordinate or ycoordinate as the annotation value or within a typeset structure as described on the plot/typesetting help page.
 • If you want to use a function of either the x-coordinate or y-coordinate, then use xcoordinate(p) or ycoordinate(p) where p is a procedure that accepts a numeric value and returns a numeric value, such as u->u^2.
 • To use a function of both coordinates, use xycoordinate(p) where p is a procedure that accepts two numeric values (the x-coordinate and y-coordinate, respectively) and returns a numeric value, such as (u,v)->u*v.
 • The number of digits displayed for the x-coordinate or y-coordinate can be specified by adding the digits=n option after the procedure p. Note that p can be omitted, as in xcoordinate(digits=5).

Examples

Add an annotation to a curve.

 > $\mathrm{plot}\left({x}^{2},x=0..1,\mathrm{annotation}=\mathrm{typeset}\left("the function",{x}^{2}\right)\right)$

Add an annotation to each point in a data plot.

 > $\mathrm{dataplot}\left(\mathrm{Matrix}\left(\left[\left[0,0\right],\left[1,2\right],\left[2,3\right],\left[3,2\right],\left[4,4\right]\right]\right),\mathrm{points},\mathrm{annotation}=\mathrm{Array}\left(\left["January","February","March","April","May"\right]\right)\right)$

Include coordinate values.

 > $\mathrm{plot}\left({x}^{2},x=0..1,\mathrm{annotation}=\mathrm{typeset}\left("the square of",'\mathrm{xcoordinate}',"is",'\mathrm{ycoordinate}'\right)\right)$

Use a function of the coordinate values and specify the number of digits.

 > $\mathrm{plot}\left({x}^{2},x=0..1,\mathrm{annotation}=\mathrm{typeset}\left("the sum of x and y coordinates is",'\mathrm{xycoordinate}'\left(\left(x,y\right)↦x+y,\mathrm{digits}=5\right)\right)\right)$

Compatibility

 • The annotation option was introduced in Maple 2017.