An Axes positioning class. The divider is initialized with lists of horizontal and vertical sizes (:mod:`mpl_toolkits.axes_grid1.axes_size`) based on which a given rectangular area will be divided. The `new_locator` method then creates a callable object that can be used as
| 14 | |
| 15 | |
| 16 | class Divider: |
| 17 | """ |
| 18 | An Axes positioning class. |
| 19 | |
| 20 | The divider is initialized with lists of horizontal and vertical sizes |
| 21 | (:mod:`mpl_toolkits.axes_grid1.axes_size`) based on which a given |
| 22 | rectangular area will be divided. |
| 23 | |
| 24 | The `new_locator` method then creates a callable object |
| 25 | that can be used as the *axes_locator* of the axes. |
| 26 | """ |
| 27 | |
| 28 | def __init__(self, fig, pos, horizontal, vertical, |
| 29 | aspect=None, anchor="C"): |
| 30 | """ |
| 31 | Parameters |
| 32 | ---------- |
| 33 | fig : Figure |
| 34 | pos : tuple of 4 floats |
| 35 | Position of the rectangle that will be divided. |
| 36 | horizontal : list of :mod:`~mpl_toolkits.axes_grid1.axes_size` |
| 37 | Sizes for horizontal division. |
| 38 | vertical : list of :mod:`~mpl_toolkits.axes_grid1.axes_size` |
| 39 | Sizes for vertical division. |
| 40 | aspect : bool, optional |
| 41 | Whether overall rectangular area is reduced so that the relative |
| 42 | part of the horizontal and vertical scales have the same scale. |
| 43 | anchor : (float, float) or {'C', 'SW', 'S', 'SE', 'E', 'NE', 'N', \ |
| 44 | 'NW', 'W'}, default: 'C' |
| 45 | Placement of the reduced rectangle, when *aspect* is True. |
| 46 | """ |
| 47 | |
| 48 | self._fig = fig |
| 49 | self._pos = pos |
| 50 | self._horizontal = horizontal |
| 51 | self._vertical = vertical |
| 52 | self._anchor = anchor |
| 53 | self.set_anchor(anchor) |
| 54 | self._aspect = aspect |
| 55 | self._xrefindex = 0 |
| 56 | self._yrefindex = 0 |
| 57 | self._locator = None |
| 58 | |
| 59 | def get_horizontal_sizes(self, renderer): |
| 60 | return np.array([s.get_size(renderer) for s in self.get_horizontal()]) |
| 61 | |
| 62 | def get_vertical_sizes(self, renderer): |
| 63 | return np.array([s.get_size(renderer) for s in self.get_vertical()]) |
| 64 | |
| 65 | def set_position(self, pos): |
| 66 | """ |
| 67 | Set the position of the rectangle. |
| 68 | |
| 69 | Parameters |
| 70 | ---------- |
| 71 | pos : tuple of 4 floats |
| 72 | position of the rectangle that will be divided |
| 73 | """ |
no outgoing calls
searching dependent graphs…