Plot Tickmarks and Gridlines - Maple Programming Help

Home : Support : Online Help : Graphics : 3-D : Options : plot/tickmarks

Plot Tickmarks and Gridlines

Options for Controlling Tickmarks and Gridlines

 Tickmarks and gridlines on plots can be specified with the tickmarks and gridlines suboptions of the axis option. Restricted forms of the tickmarks and gridlines option may also be given directly to a plotting command, outside of the axis option. For more information, see the plot/option and plot3d/option help pages.  Note that gridlines are available for 2-D plots only.

Specifying Tickmarks/Gridlines for a Single Axis

 When using the axis option, the tickmarks or gridlines for a single axis can be specified using the tickmarks=s or gridlines=s option.  The tickmark specification for all axes may be given through a single tickmarks=[s1, s2] or tickmarks=[s1, s2, s3] option for 2-D and 3-D plots respectively, where s1, s2 and s3 have the same form as s.
 The tickmarks or gridlines value s can take one of the following forms.  For brevity, the statements below refer only to tickmarks but they apply to gridlines as well.
 • non-negative integer
 This controls the number of tickmarks appearing on the axis.  Maple attempts to use a number of tickmarks as close as possible to the value requested while ensuring a reasonable gap between the tickmarks.
 • list of numeric values
 Tickmarks are placed at the exact locations specified by the numeric values.
 • list of equations
 For each equation v=t, where v is a numeric value, a tickmark with label t is placed at the exact location specified by v. For information on how to specify labels, see plot/typesetting.
 • the name piticks, decimalticks or default
 The name piticks produces tickmarks in multiples of $\mathrm{\pi }$. The name decimalticks or default produces numeric tickmarks. These names apply to the tickmarks option only and are ignored by the gridlines option.
 • a spacing(g, f) structure
 If you specify spacing(g, f), tickmarks are drawn with a gap of g between every two, where g is a numeric value.  The optional numeric value f specifies a fixed location where a tickmark is to be placed; other tickmarks are then drawn relative to this point.
 The argument g or f may also have the form c*u where c is a numeric value and u is a name that evaluates to a numeric value when evalf is applied.  In this case, the tickmarks labels will use the name u and this name will be typeset as described in plot/typesetting.  This allows you to label tickmarks with multiples of Pi, for example.
 You can also define a new constant and extend the evalf command to evaluate it. This constant can then be used in the spacing structure.  For more information, see evalf/details.

Suboptions of the tickmarks or gridline Option

 The value s can also be a list consisting of a tickmark or gridline specification as described above, followed by one or more suboptions.  This form for s is available only when the tickmarks or gridlines suboption appears inside the axis option.
 Note that tickmarks=[n], where n is an integer, is always interpreted as a tickmark at location n. To get n tickmarks, use tickmarks=n or tickmarks=[n, w], where w is a sequence of one or more suboptions.
 The available suboptions are listed below.
 • color=c or colour=c
 Specify the color of the tickmarks or gridlines.  See the plot/color help page for a description of the values that c can take.
 • linestyle=t
 Specify the line style. This option applies to gridlines only.  The value t can be one of the following names:  solid, dot, dash, dashdot, longdash, spacedash, spacedot.  The default value is solid. The value t can also be the name ticks, in which case tickmarks rather than gridlines are drawn.
 • majorlines=m
 Specify the placement of major lines. This option applies to gridlines only. Every mth gridline is heavier, where m is a positive integer.  The default is m=1.
 • rotation=r
 Specify the angle of rotation for tickmark labels. The value r must evaluate to a real number that is assumed to be in radians or be one of the names horizontal (equivalent to 0 radians) or vertical (equivalent to $\frac{\mathrm{\pi }}{2}$ radians).
 • subticks or subticks=t
 Control the display of subticks between tickmarks or gridlines.  The value t can be true (default subticks are displayed), false (no subticks are displayed), or a non-negative integer specifying the exact number of subticks between two gridlines or tickmarks.
 • thickness=t
 Specify the thickness of tickmarks or gridlines.  The value t must be a positive integer.  The default is t=1.

Notes

 The axis option, the gridlines option, and the spacing feature of the tickmarks option are not available for all interfaces.  For more information, see plot/interface. Gridlines are available for 2-D plots only.
 In some situations, Maple adds the tickmarks option with value piticks automatically. For example, $\mathrm{\pi }$ tickmarks will appear for a plot of sin(x). If $\mathrm{\pi }$ tickmarks are not desired in any of these cases, specify decimalticks to override the default behavior.

Examples

Put 10 tickmarks on each axis.

 > $\mathrm{plot3d}\left(x\mathrm{cos}\left(y\right),x=0..10,y=0..2\mathrm{\pi },\mathrm{tickmarks}=\left[10,10,10\right],\mathrm{axes}=\mathrm{boxed}\right)$

Put tickmarks at specific locations on the $x$-axis and use default tickmarks on the $y$-axis.

 > $\mathrm{plot}\left({x}^{2},x=-1..1,\mathrm{tickmarks}=\left[\left[-0.75,-0.25,0.25,0.75\right],\mathrm{default}\right]\right)$

Define labels at specific locations.

 > $\mathrm{plot}\left(x\mathrm{cos}\left(x\right),x=0..10,\mathrm{tickmarks}=\left[\mathrm{piticks},\left[-6="A",-2="B",2="C",6="D"\right]\right]\right)$

Use the seq command to generate a sequence of tickmark labels.

 > $\mathrm{plot}\left({x}^{2},x=0..10,\mathrm{tickmarks}=\left[\mathrm{default},\left[\mathrm{seq}\left(i\cdot 10=y\left[i\right],i=1..10\right)\right]\right]\right)$

Specify tickmarks in multiples of $\mathrm{\pi }$ on the vertical axis.

 > $\mathrm{plot}\left(\mathrm{arcsin}\left(x\right),x=-1..1,\mathrm{tickmarks}=\left[\mathrm{decimalticks},\mathrm{piticks}\right]\right)$

Add default gridlines to a plot.

 > $\mathrm{plot}\left(\mathrm{cos}\left(x\right),x=-2\mathrm{\pi }..2\mathrm{\pi },\mathrm{gridlines}\right)$

Draw blue gridlines.

 > $\mathrm{plot}\left(x\mathrm{cos}\left(x\right),x=0..10,\mathrm{axis}=\left[\mathrm{gridlines}=\left[10,\mathrm{color}=\mathrm{blue}\right]\right]\right)$

Put three subticks between every two tickmarks.

 > $\mathrm{plot}\left(x\mathrm{cos}\left(x\right),x=0..10,\mathrm{axis}=\left[\mathrm{tickmarks}=\left[5,\mathrm{subticks}=3\right]\right]\right)$

Use a tickmark spacing of $\frac{\mathrm{\pi }}{2}$ on the $x$-axis.

 > $\mathrm{plot}\left(\mathrm{cos}\left(x\right),x=-2\mathrm{\pi }..2\mathrm{\pi },\mathrm{tickmarks}=\left[\mathrm{spacing}\left(\frac{\mathrm{\pi }}{2}\right),\mathrm{default}\right]\right)$

Define a constant $\mathrm{\zeta }$ and label the $y$-axis with multiples of this constant.

 > $\mathrm{evalf/constant/Zeta}≔\left(\right)↦3.6:$
 > $\mathrm{plot}\left(x-\frac{{x}^{3}}{6},x=-8..8,\mathrm{tickmarks}=\left[\mathrm{default},\mathrm{spacing}\left(2\mathrm{\zeta },\mathrm{\zeta }\right)\right]\right)$

Rotate tickmarks by -Pi/4.

 > $\mathrm{plot}\left(\mathrm{sqrt}\left(x\right),x=0..10000,\mathrm{axis}\left[1\right]=\left[\mathrm{tickmarks}=\left[\mathrm{rotation}=-\frac{\mathrm{\pi }}{4}\right]\right]\right)$

Compatibility

 • The piticks and decimalticks options were introduced in Maple 15.