@@ -241,21 +241,34 @@ over so that the tick labels fit in the figure:
241
241
242
242
.. _howto-ticks :
243
243
244
- Configure the tick linewidths
245
- -----------------------------
244
+ Configure the tick widths
245
+ -------------------------
246
246
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::
251
249
252
250
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, so the above effect can also be achieved by::
264
+
265
+ import matplotlib.pyplot as plt
266
+
267
+ fig, ax = plt.subplots()
255
268
ax.plot(range(10))
256
269
257
270
for line in ax.get_xticklines() + ax.get_yticklines():
258
- line.set_markersize (10)
271
+ line.set_markeredgewidth (10)
259
272
260
273
plt.show()
261
274
0 commit comments