Skip to content

Commit 6da4d9f

Browse files
committed
Mention use of Axes.tick_params in docs.
This shortcut should be preferred over manually changing every Tick's properties.
1 parent 055ff5f commit 6da4d9f

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

doc/faq/howto_faq.rst

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -241,21 +241,34 @@ over so that the tick labels fit in the figure:
241241

242242
.. _howto-ticks:
243243

244-
Configure the tick linewidths
245-
-----------------------------
244+
Configure the tick widths
245+
-------------------------
246246

247-
In Matplotlib, the ticks are *markers*. All
248-
:class:`~matplotlib.lines.Line2D` objects support a line (solid,
249-
dashed, etc) and a marker (circle, square, tick). The tick linewidth
250-
is controlled by the "markeredgewidth" property::
247+
Wherever possible, it is recommended to use the :meth:`~Axes.tick_params` or
248+
:meth:`~Axis.set_tick_params` methods to modify tick properties::
251249

252250
import matplotlib.pyplot as plt
253-
fig = plt.figure()
254-
ax = fig.add_subplot(111)
251+
252+
fig, ax = plt.subplots()
253+
ax.plot(range(10))
254+
255+
ax.tick_params(width=10)
256+
257+
plt.show()
258+
259+
For more control of tick properties that are not provided by the above methods,
260+
it is important to know that in Matplotlib, the ticks are *markers*. All
261+
:class:`~matplotlib.lines.Line2D` objects support a line (solid, dashed, etc)
262+
and a marker (circle, square, tick). The tick width is controlled by the
263+
``"markeredgewidth"`` property::
264+
265+
import matplotlib.pyplot as plt
266+
267+
fig, ax = plt.subplots()
255268
ax.plot(range(10))
256269

257270
for line in ax.get_xticklines() + ax.get_yticklines():
258-
line.set_markersize(10)
271+
line.set_markeredgewidth(10)
259272

260273
plt.show()
261274

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy