Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6da4d9f

Browse filesBrowse 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
Copy full SHA for 6da4d9f

File tree

Expand file treeCollapse file tree

1 file changed

+22
-9
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+22
-9
lines changed

‎doc/faq/howto_faq.rst

Copy file name to clipboardExpand all lines: doc/faq/howto_faq.rst
+22-9Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.