Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ecd00a3

Browse files
committed
DOC: a bit more about ticks for axes
1 parent 5f69e98 commit ecd00a3

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

galleries/users_explain/axes/index.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,18 @@ Other important methods set the extent on the axes (`~.axes.Axes.set_xlim`, `~.a
147147

148148
The Axes class also has helpers to deal with Axis ticks and their labels. Most straight-forward is `~.axes.Axes.set_xticks` and `~.axes.Axes.set_yticks` which manually set the tick locations and optionally their labels. Minor ticks can be toggled with `~.axes.Axes.minorticks_on` or `~.axes.Axes.minorticks_off`.
149149

150-
Setting scales and controlling the Axis can be highly customized beyond these Axes-level helpers. An introduction to these methods can be found in :ref:`users_axis`, or the API reference for `.axis.Axis`.
150+
Many aspects of Axes ticks and tick labeling can be adjusted using `~.axes.Axes.tick_params`. For instance, to label the top of the axes instead of the bottom,color the ticks red, and color the ticklabels green:
151+
152+
.. plot::
153+
:include-source:
154+
155+
fig, ax = plt.subplots(figsize=(4, 2.5))
156+
ax.plot(np.arange(10))
157+
ax.tick_params(top=True, labeltop=True, color='red', axis='x',
158+
labelcolor='green')
159+
160+
161+
More fine-grained control on ticks, setting scales, and controlling the Axis can be highly customized beyond these Axes-level helpers. An introduction to these methods can be found in :ref:`users_axis`, or the API reference for `.axis.Axis`.
151162

152163
Axes layout
153164
-----------

0 commit comments

Comments
 (0)