|
41 | 41 |
|
42 | 42 | class AxesStack(Stack):
|
43 | 43 | """
|
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 | + |
49 | 56 | """
|
50 | 57 | def __init__(self):
|
51 | 58 | Stack.__init__(self)
|
@@ -74,9 +81,14 @@ def _entry_from_axes(self, e):
|
74 | 81 | return (k, (ind, e))
|
75 | 82 |
|
76 | 83 | def remove(self, a):
|
| 84 | + """Remove the axes from the stack.""" |
77 | 85 | Stack.remove(self, self._entry_from_axes(a))
|
78 |
| - |
| 86 | + |
79 | 87 | def bubble(self, a):
|
| 88 | + """ |
| 89 | + Move the given axes, which must already exist in the |
| 90 | + stack, to the top. |
| 91 | + """ |
80 | 92 | return Stack.bubble(self, self._entry_from_axes(a))
|
81 | 93 |
|
82 | 94 | def add(self, key, a):
|
@@ -108,7 +120,12 @@ def add(self, key, a):
|
108 | 120 | return Stack.push(self, (key, (self._ind, a)))
|
109 | 121 |
|
110 | 122 | 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 | + """ |
112 | 129 | if not len(self._elements):
|
113 | 130 | return self._default, self._default
|
114 | 131 | else:
|
|
0 commit comments