Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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 13 commits into from
Dec 16, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add documentation for axis_grid1.inset_locator.InsetPosition
  • Loading branch information
sargas committed Nov 15, 2015
commit 748fff836587a137b99d237b48cbbf26cb18c962
34 changes: 32 additions & 2 deletions lib/mpl_toolkits/axes_grid1/inset_locator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,41 @@
from matplotlib import docstring


@docstring.dedent_interpd
class InsetPosition(object):
"""
An object for positioning an inset axes.

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):
self.parent = parent
self.lbwh = lbwh # position of the inset axes in
# the normalized coordinate of the parent axes
self.lbwh = lbwh

def __call__(self, ax, renderer):
bbox_parent = self.parent.get_position(original=False)
Expand Down