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

Skip to content

Commit ea96b24

Browse files
authored
Merge pull request #19917 from meeseeksmachine/auto-backport-of-pr-19911-on-v3.4.x
Backport PR #19911 on branch v3.4.x (Shorten "how-to draw order")
2 parents 4ea2731 + cd8d4ab commit ea96b24

File tree

2 files changed

+11
-20
lines changed

2 files changed

+11
-20
lines changed

doc/faq/howto_faq.rst

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -261,25 +261,12 @@ setting in the right subplots.
261261

262262
.. _howto-set-zorder:
263263

264-
Control the depth of plot elements
265-
----------------------------------
266-
267-
Within an axes, the order that the various lines, markers, text,
268-
collections, etc appear is determined by the
269-
:meth:`~matplotlib.artist.Artist.set_zorder` property. The default
270-
order is patches, lines, text, with collections of lines and
271-
collections of patches appearing at the same level as regular lines
272-
and patches, respectively::
273-
274-
line, = ax.plot(x, y, zorder=10)
275-
276-
.. only:: html
277-
278-
See :doc:`/gallery/misc/zorder_demo` for a complete example.
264+
Control the draw order of plot elements
265+
---------------------------------------
279266

280-
You can also use the Axes property
281-
:meth:`~matplotlib.axes.Axes.set_axisbelow` to control whether the grid
282-
lines are placed above or below your other plot elements.
267+
The draw order of plot elements, and thus which elements will be on top, is
268+
determined by the `~.Artist.set_zorder` property.
269+
See :doc:`/gallery/misc/zorder_demo` for a detailed description.
283270

284271
.. _howto-axis-equal:
285272

examples/misc/zorder_demo.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@
2424
2525
.. note::
2626
27-
`~.axes.Axes.set_axisbelow` and :rc:`axes.axisbelow` can further modify the
28-
zorder of ticks and grid lines.
27+
`~.axes.Axes.set_axisbelow` and :rc:`axes.axisbelow` are convenient helpers
28+
for setting the zorder of ticks and grid lines.
29+
30+
Drawing is done per `~.axes.Axes` at a time. If you have overlapping Axes, all
31+
elements of the second Axes are drawn on top of the first Axes, irrespective of
32+
their relative zorder.
2933
"""
3034

3135
import matplotlib.pyplot as plt

0 commit comments

Comments
 (0)