-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add documentation for mpl_toolkits.axes_grid1.inset_locator #4864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
afd3afb
Build API documentation for mpl_toolkit.axes_grid1.inset_locator
sargas 6bc091c
Add documention for inset_locator.mark_inset in axes_grid1
sargas 281be93
Add documention to axis_grid1.inset_locator.zoomed_insert-axes
sargas a8f5eb6
Add documentation for axis_grid1.inset_locator.inset_axis
sargas 748fff8
Add documentation for axis_grid1.inset_locator.InsetPosition
sargas 2086399
Fix up imports in axis_grid1.inset_locator
sargas 4c7abe5
Simplify axes_grid1's AnchoredLocatorBase subclasses.
sargas b857f71
Add docstring for axes_grid1.inset_locator.BboxPatch
sargas 9c0cff1
Add documentation for axes_grid1.inset_locator.BboxConnector
sargas 0898052
Add documentation for axes_grid1.inset_locator.BboxConnectorPatch
sargas e499425
Add module doc for axes_grid1.inset_locator
sargas a55250f
Move class docstrings in axes_grid1.inset_locator to constructors
sargas e6181de
Reform kwarg documentation in axes_grid1.inset_locator
sargas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Move class docstrings in axes_grid1.inset_locator to constructors
Fixes Py2k compatibility
- Loading branch information
commit a55250f42f5fc01ff1de20d8fa6eec49caaa9179
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,39 +15,39 @@ | |
from .parasite_axes import HostAxes | ||
|
||
|
||
@docstring.dedent_interpd | ||
class InsetPosition(object): | ||
""" | ||
An object for positioning an inset axes. | ||
@docstring.dedent_interpd | ||
def __init__(self, parent, lbwh): | ||
""" | ||
An object for positioning an inset axes. | ||
|
||
This is created by specifying the normalized coordinates in the axes, | ||
instead of the figure. | ||
This is created by specifying the normalized coordinates in the axes, | ||
instead of the figure. | ||
|
||
Parameters | ||
---------- | ||
parent : `matplotlib.axes.Axes` | ||
Axes to use for normalizing coordinates. | ||
|
||
lbwh : iterable of four floats | ||
The left edge, bottom edge, width, and height of the inset axes, in | ||
units of the normalized coordinate of the *parent* axes. | ||
|
||
See Also | ||
-------- | ||
:meth:`matplotlib.axes.Axes.set_axes_locator` | ||
|
||
Examples | ||
-------- | ||
The following bounds the inset axes to a box with 20%% of the parent | ||
axes's height and 40%% of the width. The size of the axes specified | ||
([0, 0, 1, 1]) ensures that the axes completely fills the bounding box: | ||
|
||
>>> parent_axes = plt.gca() | ||
>>> ax_ins = plt.axes([0, 0, 1, 1]) | ||
>>> ip = InsetPosition(ax, [0.5, 0.1, 0.4, 0.2]) | ||
>>> ax_ins.set_axes_locator(ip) | ||
""" | ||
def __init__(self, parent, lbwh): | ||
Parameters | ||
---------- | ||
parent : `matplotlib.axes.Axes` | ||
Axes to use for normalizing coordinates. | ||
|
||
lbwh : iterable of four floats | ||
The left edge, bottom edge, width, and height of the inset axes, in | ||
units of the normalized coordinate of the *parent* axes. | ||
|
||
See Also | ||
-------- | ||
:meth:`matplotlib.axes.Axes.set_axes_locator` | ||
|
||
Examples | ||
-------- | ||
The following bounds the inset axes to a box with 20%% of the parent | ||
axes's height and 40%% of the width. The size of the axes specified | ||
([0, 0, 1, 1]) ensures that the axes completely fills the bounding box: | ||
|
||
>>> parent_axes = plt.gca() | ||
>>> ax_ins = plt.axes([0, 0, 1, 1]) | ||
>>> ip = InsetPosition(ax, [0.5, 0.1, 0.4, 0.2]) | ||
>>> ax_ins.set_axes_locator(ip) | ||
""" | ||
self.parent = parent | ||
self.lbwh = lbwh | ||
|
||
|
@@ -146,20 +146,20 @@ def get_extent(self, renderer): | |
return w*self.zoom+2*pad, h*self.zoom+2*pad, xd+pad, yd+pad | ||
|
||
|
||
@docstring.dedent_interpd | ||
class BboxPatch(Patch): | ||
""" | ||
Patch showing the shape bounded by a Bbox. | ||
@docstring.dedent_interpd | ||
def __init__(self, bbox, **kwargs): | ||
""" | ||
Patch showing the shape bounded by a Bbox. | ||
|
||
Parameters | ||
---------- | ||
bbox : `matplotlib.transforms.Bbox` | ||
Bbox to use for the extents of this patch. | ||
Parameters | ||
---------- | ||
bbox : `matplotlib.transforms.Bbox` | ||
Bbox to use for the extents of this patch. | ||
|
||
The kwargs are Patch properties: | ||
%(Patch)s | ||
""" | ||
def __init__(self, bbox, **kwargs): | ||
The kwargs are Patch properties: | ||
%(Patch)s | ||
""" | ||
if "transform" in kwargs: | ||
raise ValueError("transform should not be set") | ||
|
||
|
@@ -188,37 +188,7 @@ def get_path(self): | |
get_path.__doc__ = Patch.get_path.__doc__ | ||
|
||
|
||
@docstring.dedent_interpd | ||
class BboxConnector(Patch): | ||
""" | ||
Connect two bboxes with a straight line. | ||
|
||
Parameters | ||
---------- | ||
bbox1, bbox2 : `matplotlib.transforms.Bbox` | ||
Bounding boxes to connect. | ||
|
||
loc1 : {1, 2, 3, 4} | ||
Corner of *bbox1* to draw the line. Valid values are:: | ||
|
||
'upper right' : 1, | ||
'upper left' : 2, | ||
'lower left' : 3, | ||
'lower right' : 4 | ||
|
||
loc2 : {1, 2, 3, 4}, optional | ||
Corner of *bbox2* to draw the line. If None, defaults to *loc1*. | ||
Valid values are:: | ||
|
||
'upper right' : 1, | ||
'upper left' : 2, | ||
'lower left' : 3, | ||
'lower right' : 4 | ||
|
||
The kwargs are Patch properties for the line drawn: | ||
%(Patch)s | ||
""" | ||
|
||
@staticmethod | ||
def get_bbox_edge_pos(bbox, loc): | ||
""" | ||
|
@@ -305,7 +275,36 @@ def connect_bbox(bbox1, bbox2, loc1, loc2=None): | |
|
||
return Path(verts, codes) | ||
|
||
@docstring.dedent_interpd | ||
def __init__(self, bbox1, bbox2, loc1, loc2=None, **kwargs): | ||
""" | ||
Connect two bboxes with a straight line. | ||
|
||
Parameters | ||
---------- | ||
bbox1, bbox2 : `matplotlib.transforms.Bbox` | ||
Bounding boxes to connect. | ||
|
||
loc1 : {1, 2, 3, 4} | ||
Corner of *bbox1* to draw the line. Valid values are:: | ||
|
||
'upper right' : 1, | ||
'upper left' : 2, | ||
'lower left' : 3, | ||
'lower right' : 4 | ||
|
||
loc2 : {1, 2, 3, 4}, optional | ||
Corner of *bbox2* to draw the line. If None, defaults to *loc1*. | ||
Valid values are:: | ||
|
||
'upper right' : 1, | ||
'upper left' : 2, | ||
'lower left' : 3, | ||
'lower right' : 4 | ||
|
||
The kwargs are Patch properties for the line drawn: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same with the |
||
%(Patch)s | ||
""" | ||
if "transform" in kwargs: | ||
raise ValueError("transform should not be set") | ||
|
||
|
@@ -322,43 +321,43 @@ def get_path(self): | |
get_path.__doc__ = Patch.get_path.__doc__ | ||
|
||
|
||
@docstring.dedent_interpd | ||
class BboxConnectorPatch(BboxConnector): | ||
""" | ||
Connect two bboxes with a quadrilateral. | ||
@docstring.dedent_interpd | ||
def __init__(self, bbox1, bbox2, loc1a, loc2a, loc1b, loc2b, **kwargs): | ||
""" | ||
Connect two bboxes with a quadrilateral. | ||
|
||
The quadrilateral is specified by two lines that start and end at corners | ||
of the bboxes. The four sides of the quadrilateral are defined by the two | ||
lines given, the line between the two corners specified in *bbox1* and the | ||
line between the two corners specified in *bbox2*. | ||
The quadrilateral is specified by two lines that start and end at corners | ||
of the bboxes. The four sides of the quadrilateral are defined by the two | ||
lines given, the line between the two corners specified in *bbox1* and the | ||
line between the two corners specified in *bbox2*. | ||
|
||
Parameters | ||
---------- | ||
bbox1, bbox2 : `matplotlib.transforms.Bbox` | ||
Bounding boxes to connect. | ||
Parameters | ||
---------- | ||
bbox1, bbox2 : `matplotlib.transforms.Bbox` | ||
Bounding boxes to connect. | ||
|
||
loc1a, loc2a : {1, 2, 3, 4} | ||
Corners of *bbox1* and *bbox2* to draw the first line. | ||
Valid values are:: | ||
loc1a, loc2a : {1, 2, 3, 4} | ||
Corners of *bbox1* and *bbox2* to draw the first line. | ||
Valid values are:: | ||
|
||
'upper right' : 1, | ||
'upper left' : 2, | ||
'lower left' : 3, | ||
'lower right' : 4 | ||
'upper right' : 1, | ||
'upper left' : 2, | ||
'lower left' : 3, | ||
'lower right' : 4 | ||
|
||
loc1b, loc2b : {1, 2, 3, 4} | ||
Corners of *bbox1* and *bbox2* to draw the second line. | ||
Valid values are:: | ||
loc1b, loc2b : {1, 2, 3, 4} | ||
Corners of *bbox1* and *bbox2* to draw the second line. | ||
Valid values are:: | ||
|
||
'upper right' : 1, | ||
'upper left' : 2, | ||
'lower left' : 3, | ||
'lower right' : 4 | ||
'upper right' : 1, | ||
'upper left' : 2, | ||
'lower left' : 3, | ||
'lower right' : 4 | ||
|
||
The kwargs are Patch properties for the line drawn: | ||
%(Patch)s | ||
""" | ||
def __init__(self, bbox1, bbox2, loc1a, loc2a, loc1b, loc2b, **kwargs): | ||
The kwargs are Patch properties for the line drawn: | ||
%(Patch)s | ||
""" | ||
if "transform" in kwargs: | ||
raise ValueError("transform should not be set") | ||
BboxConnector.__init__(self, bbox1, bbox2, loc1a, loc2a, **kwargs) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put this in a
Notes
section to keep numpydoc happy?