8000 Review actions #2 · pelson/matplotlib@564e042 · GitHub
[go: up one dir, main page]

Skip to content

Commit 564e042

Browse files
author
Phil Elson
committed
Review actions #2
1 parent 836a459 commit 564e042

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

lib/matplotlib/axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3512,7 +3512,7 @@ def axvspan(self, xmin, xmax, ymin=0, ymax=1, **kwargs):
35123512
Return value is the :class:`matplotlib.patches.Polygon`
35133513
instance.
35143514
3515-
Examples:
3515+
Examples::
35163516
35173517
# draw a vertical green translucent rectangle from x=1.25 to 1.55
35183518
# that spans the yrange of the axes

lib/matplotlib/figure.py

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,18 @@
4141

4242
class AxesStack(Stack):
4343
"""
44-
Specialization of the Stack to handle all
45-
tracking of Axes in a Figure. This requires storing
46-
key, (ind, axes) pairs. The key is based on the args and kwargs
47-
used in generating the Axes. ind is a serial number for tracking
48-
the order in which axes were added.
44+
Specialization of the Stack to handle all tracking of Axes in a Figure.
45+
This stack stores ``key, (ind, axes)`` pairs, where:
46+
47+
* **key** should be a hash of the args and kwargs
48+
used in generating the Axes.
49+
* **ind** is a serial number for tracking the order
50+
in which axes were added.
51+
52+
The AxesStack is a callable, where ``ax_stack()`` returns
53+
the current axes. Alternatively the :meth:`current_key_axes` will
54+
return the current key and associated axes.
55+
4956
"""
5057
def __init__(self):
5158
Stack.__init__(self)
@@ -74,9 +81,14 @@ def _entry_from_axes(self, e):
7481
return (k, (ind, e))
7582

7683
def remove(self, a):
84+
"""Remove the axes from the stack."""
7785
Stack.remove(self, self._entry_from_axes(a))
78-
86+
7987
def bubble(self, a):
88+
"""
89+
Move the given axes, which must already exist in the
90+
stack, to the top.
91+
"""
8092
return Stack.bubble(self, self._entry_from_axes(a))
8193

8294
def add(self, key, a):
@@ -108,7 +120,12 @@ def add(self, key, a):
108120
return Stack.push(self, (key, (self._ind, a)))
109121

110122
def current_key_axes(self):
111-
"""Return a tuple of (key, axes) for the active axes."""
123+
"""
124+
Return a tuple of ``(key, axes)`` for the active axes.
125+
126+
If no axes exists on the stack, then returns ``(None, None)``.
127+
128+
"""
112129
if not len(self._elements):
113130
return self._default, self._default
114131
else:

0 commit comments

Comments
 (0)
0