Plot Tickmarks and Gridlines
Options for Controlling Tickmarks and Gridlines
Specifying Tickmarks/Gridlines for a Single Axis
Suboptions of the tickmarks or gridline Option
Notes
Examples
Compatibility
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.
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 π. 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.
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 π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.
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, π tickmarks will appear for a plot of sin(x). If π tickmarks are not desired in any of these cases, specify decimalticks to override the default behavior.
Put 10 tickmarks on each axis.
plot3d⁡x⁢cos⁡y,x=0..10,y=0..2⁢π,tickmarks=10,10,10,axes=boxed
Put tickmarks at specific locations on the x-axis and use default tickmarks on the y-axis.
plot⁡x2,x=−1..1,tickmarks=−0.75,−0.25,0.25,0.75,default
Define labels at specific locations.
plot⁡x⁢cos⁡x,x=0..10,tickmarks=piticks,−6=A,−2=B,2=C,6=D
Use the seq command to generate a sequence of tickmark labels.
plot⁡x2,x=0..10,tickmarks=default,seq⁡i⋅10=yi,i=1..10
Specify tickmarks in multiples of π on the vertical axis.
plot⁡arcsin⁡x,x=−1..1,tickmarks=decimalticks,piticks
Add default gridlines to a plot.
plot⁡cos⁡x,x=−2⁢π..2⁢π,gridlines
Draw blue gridlines.
plot⁡x⁢cos⁡x,x=0..10,axis=gridlines=10,color=blue
Put three subticks between every two tickmarks.
plot⁡x⁢cos⁡x,x=0..10,axis=tickmarks=5,subticks=3
Use a tickmark spacing of π2 on the x-axis.
plot⁡cos⁡x,x=−2⁢π..2⁢π,tickmarks=spacing⁡π2,default
Define a constant Ζ and label the y-axis with multiples of this constant.
`evalf/constant/Zeta`≔↦3.6:
plot⁡x−x36,x=−8..8,tickmarks=default,spacing⁡2⁢Ζ,Ζ
Rotate tickmarks by -Pi/4.
plot⁡sqrt⁡x,x=0..10000,axis1=tickmarks=rotation=−π4
The piticks and decimalticks options were introduced in Maple 15.
For more information on Maple 15 changes, see Updates in Maple 15.
The rotation option was introduced in Maple 2018.
For more information on Maple 2018 changes, see Updates in Maple 2018.
See Also
evalf
evalf/details
plot
plot/axis
plot/interface
plot/options
plot/typesetting
plot3d
plot3d/option
seq
Download Help Document