15
15
from .parasite_axes import HostAxes
16
16
17
17
18
- @docstring .dedent_interpd
19
18
class InsetPosition (object ):
20
- """
21
- An object for positioning an inset axes.
19
+ @docstring .dedent_interpd
20
+ def __init__ (self , parent , lbwh ):
21
+ """
22
+ An object for positioning an inset axes.
22
23
23
- This is created by specifying the normalized coordinates in the axes,
24
- instead of the figure.
24
+ This is created by specifying the normalized coordinates in the axes,
25
+ instead of the figure.
25
26
26
- Parameters
27
- ----------
28
- parent : `matplotlib.axes.Axes`
29
- Axes to use for normalizing coordinates.
30
-
31
- lbwh : iterable of four floats
32
- The left edge, bottom edge, width, and height of the inset axes, in
33
- units of the normalized coordinate of the *parent* axes.
34
-
35
- See Also
36
- --------
37
- :meth:`matplotlib.axes.Axes.set_axes_locator`
38
-
39
- Examples
40
- --------
41
- The following bounds the inset axes to a box with 20%% of the parent
42
- axes's height and 40%% of the width. The size of the axes specified
43
- ([0, 0, 1, 1]) ensures that the axes completely fills the bounding box:
44
-
45
- >>> parent_axes = plt.gca()
46
- >>> ax_ins = plt.axes([0, 0, 1, 1])
47
- >>> ip = InsetPosition(ax, [0.5, 0.1, 0.4, 0.2])
48
- >>> ax_ins.set_axes_locator(ip)
49
- """
50
- def __init__ (self , parent , lbwh ):
27
+ Parameters
28
+ ----------
29
+ parent : `matplotlib.axes.Axes`
30
+ Axes to use for normalizing coordinates.
31
+
32
+ lbwh : iterable of four floats
33
+ The left edge, bottom edge, width, and height of the inset axes, in
34
+ units of the normalized coordinate of the *parent* axes.
35
+
36
+ See Also
37
+ --------
38
+ :meth:`matplotlib.axes.Axes.set_axes_locator`
39
+
40
+ Examples
41
+ --------
42
+ The following bounds the inset axes to a box with 20%% of the parent
43
+ axes's height and 40%% of the width. The size of the axes specified
44
+ ([0, 0, 1, 1]) ensures that the axes completely fills the bounding box:
45
+
46
+ >>> parent_axes = plt.gca()
47
+ >>> ax_ins = plt.axes([0, 0, 1, 1])
48
+ >>> ip = InsetPosition(ax, [0.5, 0.1, 0.4, 0.2])
49
+ >>> ax_ins.set_axes_locator(ip)
50
+ """
51
51
self .parent = parent
52
52
self .lbwh = lbwh
53
53
@@ -146,20 +146,20 @@ def get_extent(self, renderer):
146
146
return w * self .zoom + 2 * pad , h * self .zoom + 2 * pad , xd + pad , yd + pad
147
147
148
148
149
- @docstring .dedent_interpd
150
149
class BboxPatch (Patch ):
151
- """
152
- Patch showing the shape bounded by a Bbox.
150
+ @docstring .dedent_interpd
151
+ def __init__ (self , bbox , ** kwargs ):
152
+ """
153
+ Patch showing the shape bounded by a Bbox.
153
154
154
- Parameters
155
- ----------
156
- bbox : `matplotlib.transforms.Bbox`
157
- Bbox to use for the extents of this patch.
155
+ Parameters
156
+ ----------
157
+ bbox : `matplotlib.transforms.Bbox`
158
+ Bbox to use for the extents of this patch.
158
159
159
- The kwargs are Patch properties:
160
- %(Patch)s
161
- """
162
- def __init__ (self , bbox , ** kwargs ):
160
+ The kwargs are Patch properties:
161
+ %(Patch)s
162
+ """
163
163
if "transform" in kwargs :
164
164
raise ValueError ("transform should not be set" )
165
165
@@ -188,37 +188,7 @@ def get_path(self):
188
188
get_path .__doc__ = Patch .get_path .__doc__
189
189
190
190
191
- @docstring .dedent_interpd
192
191
class BboxConnector (Patch ):
193
- """
194
- Connect two bboxes with a straight line.
195
-
196
- Parameters
197
- ----------
198
- bbox1, bbox2 : `matplotlib.transforms.Bbox`
199
- Bounding boxes to connect.
200
-
201
- loc1 : {1, 2, 3, 4}
202
- Corner of *bbox1* to draw the line. Valid values are::
203
-
204
- 'upper right' : 1,
205
- 'upper left' : 2,
206
- 'lower left' : 3,
207
- 'lower right' : 4
208
-
209
- loc2 : {1, 2, 3, 4}, optional
210
- Corner of *bbox2* to draw the line. If None, defaults to *loc1*.
211
- Valid values are::
212
-
213
- 'upper right' : 1,
214
- 'upper left' : 2,
215
- 'lower left' : 3,
216
- 'lower right' : 4
217
-
218
- The kwargs are Patch properties for the line drawn:
219
- %(Patch)s
220
- """
221
-
222
192
@staticmethod
223
193
def get_bbox_edge_pos (bbox , loc ):
224
194
"""
@@ -305,7 +275,36 @@ def connect_bbox(bbox1, bbox2, loc1, loc2=None):
305
275
306
276
return Path (verts , codes )
307
277
278
+ @docstring .dedent_interpd
308
279
def __init__ (self , bbox1 , bbox2 , loc1 , loc2 = None , ** kwargs ):
280
+ """
281
+ Connect two bboxes with a straight line.
282
+
283
+ Parameters
284
+ ----------
285
+ bbox1, bbox2 : `matplotlib.transforms.Bbox`
286
+ Bounding boxes to connect.
287
+
288
+ loc1 : {1, 2, 3, 4}
289
+ Corner of *bbox1* to draw the line. Valid values are::
290
+
291
+ 'upper right' : 1,
292
+ 'upper left' : 2,
293
+ 'lower left' : 3,
294
+ 'lower right' : 4
295
+
296
+ loc2 : {1, 2, 3, 4}, optional
297
+ Corner of *bbox2* to draw the line. If None, defaults to *loc1*.
298
+ Valid values are::
299
+
300
+ 'upper right' : 1,
301
+ 'upper left' : 2,
302
+ 'lower left' : 3,
303
+ 'lower right' : 4
304
+
305
+ The kwargs are Patch properties for the line drawn:
306
+ %(Patch)s
307
+ """
309
308
if "transform" in kwargs :
310
309
raise ValueError ("transform should not be set" )
311
310
@@ -322,43 +321,43 @@ def get_path(self):
322
321
get_path .__doc__ = Patch .get_path .__doc__
323
322
324
323
325
- @docstring .dedent_interpd
326
324
class BboxConnectorPatch (BboxConnector ):
327
- """
328
- Connect two bboxes with a quadrilateral.
325
+ @docstring .dedent_interpd
326
+ def __init__ (self , bbox1 , bbox2 , loc1a , loc2a , loc1b , loc2b , ** kwargs ):
327
+ """
328
+ Connect two bboxes with a quadrilateral.
329
329
330
- The quadrilateral is specified by two lines that start and end at corners
331
- of the bboxes. The four sides of the quadrilateral are defined by the two
332
- lines given, the line between the two corners specified in *bbox1* and the
333
- line between the two corners specified in *bbox2*.
330
+ The quadrilateral is specified by two lines that start and end at corners
331
+ of the bboxes. The four sides of the quadrilateral are defined by the two
332
+ lines given, the line between the two corners specified in *bbox1* and the
333
+ line between the two corners specified in *bbox2*.
334
334
335
- Parameters
336
- ----------
337
- bbox1, bbox2 : `matplotlib.transforms.Bbox`
338
- Bounding boxes to connect.
335
+ Parameters
336
+ ----------
337
+ bbox1, bbox2 : `matplotlib.transforms.Bbox`
338
+ Bounding boxes to connect.
339
339
340
- loc1a, loc2a : {1, 2, 3, 4}
341
- Corners of *bbox1* and *bbox2* to draw the first line.
342
- Valid values are::
340
+ loc1a, loc2a : {1, 2, 3, 4}
341
+ Corners of *bbox1* and *bbox2* to draw the first line.
342
+ Valid values are::
343
343
344
- 'upper right' : 1,
345
- 'upper left' : 2,
346
- 'lower left' : 3,
347
- 'lower right' : 4
344
+ 'upper right' : 1,
345
+ 'upper left' : 2,
346
+ 'lower left' : 3,
347
+ 'lower right' : 4
348
348
349
- loc1b, loc2b : {1, 2, 3, 4}
350
- Corners of *bbox1* and *bbox2* to draw the second line.
351
- Valid values are::
349
+ loc1b, loc2b : {1, 2, 3, 4}
350
+ Corners of *bbox1* and *bbox2* to draw the second line.
351
+ Valid values are::
352
352
353
- 'upper right' : 1,
354
- 'upper left' : 2,
355
- 'lower left' : 3,
356
- 'lower right' : 4
353
+ 'upper right' : 1,
354
+ 'upper left' : 2,
355
+ 'lower left' : 3,
356
+ 'lower right' : 4
357
357
358
- The kwargs are Patch properties for the line drawn:
359
- %(Patch)s
360
- """
361
- def __init__ (self , bbox1 , bbox2 , loc1a , loc2a , loc1b , loc2b , ** kwargs ):
358
+ The kwargs are Patch properties for the line drawn:
359
+ %(Patch)s
360
+ """
362
361
if "transform" in kwargs :
363
362
raise ValueError ("transform should not be set" )
364
363
BboxConnector .__init__ (self , bbox1 , bbox2 , loc1a , loc2a , ** kwargs )
0 commit comments