8000 Add documentation for mpl_toolkits.axes_grid1.inset_locator by sargas · Pull Request #4864 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

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 documention for inset_locator.mark_inset in axes_grid1
  • Loading branch information
sargas committed Nov 15, 2015
commit 6bc091ce6af72589edf02884fc59137b418d4898
36 changes: 32 additions & 4 deletions lib/mpl_toolkits/axes_grid1/inset_locator.py
8000
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
from __future__ import (absolute_import, division, print_function,
unicode_literals)

from matplotlib.externals import six

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please leave the six import

from matplotlib.offsetbox import AnchoredOffsetbox
#from matplotlib.transforms import IdentityTransform

import matplotlib.transforms as mtrans
from .parasite_axes import HostAxes # subclasses mpl_axes

from matplotlib.transforms import Bbox, TransformedBbox, IdentityTransform

from matplotlib.patches import Patch
from matplotlib.path import Path

from matplotlib.patches import Rectangle
from matplotlib import docstring


class InsetPosition(object):
Expand Down Expand Up @@ -311,7 +308,38 @@ def zoomed_inset_axes(parent_axes, zoom, loc=1,
return inset_axes


@docstring.dedent_interpd
def mark_inset(parent_axes, inset_axes, loc1, loc2, **kwargs):
"""
Draw a box to mark the location of an area represented by an inset axes.

This function draws a box in *parent_axes* at the bounding box of
*inset_axes*, and shows a connection with the inset axes by drawing lines
at the corners, giving a "zoomed in" effect.

Parameters
----------
parent_axes : `matplotlib.axes.Axes`
Axes which contains the area of the inset axes.

inset_axes : `matplotlib.axes.Axes`
The inset axes.

loc1, loc2 : {1, 2, 3, 4}
Corners to use for connecting the inset axes and the area in the
parent axes.

The kwargs are Patch properties for the lines and box drawn:
%(Patch)s

Returns
-------
pp : `matplotlib.patches.Patch`
The patch drawn to represent the area of the inset axes.

p1, p2 : `matplotlib.patches.Patch`
The patches connecting two corners of the inset axes and its area.
"""
rect = TransformedBbox(inset_axes.viewLim, parent_axes.transData)

pp = BboxPatch(rect, **kwargs)
Expand Down
0