mpl_toolkits.axes_grid1.inset_locator
A collection of functions and objects for creating or placing inset axes.
-
class mpl_toolkits.axes_grid1.inset_locator.AnchoredLocatorBase(bbox_to_anchor, offsetbox, loc, borderpad=0.5, bbox_transform=None) -
Bases:
matplotlib.offsetbox.AnchoredOffsetbox-
draw(renderer)
-
-
class mpl_toolkits.axes_grid1.inset_locator.AnchoredSizeLocator(bbox_to_anchor, x_size, y_size, loc, borderpad=0.5, bbox_transform=None) -
Bases:
mpl_toolkits.axes_grid1.inset_locator.AnchoredLocatorBase-
get_extent(renderer)
-
-
class mpl_toolkits.axes_grid1.inset_locator.AnchoredZoomLocator(parent_axes, zoom, loc, borderpad=0.5, bbox_to_anchor=None, bbox_transform=None) -
Bases:
mpl_toolkits.axes_grid1.inset_locator.AnchoredLocatorBase-
get_extent(renderer)
-
-
class mpl_toolkits.axes_grid1.inset_locator.BboxConnector(bbox1, bbox2, loc1, loc2=None, **kwargs) -
Bases:
matplotlib.patches.PatchConnect two bboxes with a straight line.
Parameters: bbox1, bbox2 :
matplotlib.transforms.BboxBounding 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
**kwargs
Patch properties for the line drawn. Valid arguments include:
Property Description agg_filterunknown alphafloat or None animated[True | False] antialiasedor aa[True | False] or None for default axesan Axesinstancecapstyle[?butt? | ?round? | ?projecting?] clip_boxa matplotlib.transforms.Bboxinstanceclip_on[True | False] clip_path[ ( Path,Transform) |Patch| None ]colormatplotlib color spec containsa callable function edgecoloror ecmpl color spec, or None for default, or ?none? for no color facecoloror fcmpl color spec, or None for default, or ?none? for no color figurea matplotlib.figure.Figureinstancefill[True | False] gidan id string hatch[?/? | ?\? | ?|? | ?-? | ?+? | ?x? | ?o? | ?O? | ?.? | ?*?] joinstyle[?miter? | ?round? | ?bevel?] labelstring or anything printable with ?%s? conversion. linestyleor ls[?solid? | ?dashed?, ?dashdot?, ?dotted? | (offset, on-off-dash-seq) | '-'|'--'|'-.'|':'|'None'|' '|'']linewidthor lwfloat or None for default path_effectsunknown picker[None|float|boolean|callable] rasterized[True | False | None] sketch_paramsunknown snapunknown transformTransforminstanceurla url string visible[True | False] zorderany number -
static connect_bbox(bbox1, bbox2, loc1, loc2=None) -
Helper function to obtain a Path from one bbox to another.
Parameters: bbox1, bbox2 :
matplotlib.transforms.BboxBounding boxes to connect.
loc1 : {1, 2, 3, 4}
Corner of bbox1 to use. 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 use. If None, defaults to loc1. Valid values are:
'upper right' : 1, 'upper left' : 2, 'lower left' : 3, 'lower right' : 4
Returns: path :
matplotlib.path.PathA line segment from the loc1 corner of bbox1 to the loc2 corner of bbox2.
-
static get_bbox_edge_pos(bbox, loc) -
Helper function to obtain the location of a corner of a bbox
Parameters: bbox :
matplotlib.transforms.Bboxloc : {1, 2, 3, 4}
Corner of bbox. Valid values are:
'upper right' : 1, 'upper left' : 2, 'lower left' : 3, 'lower right' : 4
Returns: x, y : float
Coordinates of the corner specified by loc.
-
get_path() -
Return the path of this patch
-
-
class mpl_toolkits.axes_grid1.inset_locator.BboxConnectorPatch(bbox1, bbox2, loc1a, loc2a, loc1b, loc2b, **kwargs) -
Bases:
mpl_toolkits.axes_grid1.inset_locator.BboxConnectorConnect 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.
Parameters: bbox1, bbox2 :
matplotlib.transforms.BboxBounding boxes to connect.
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
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
**kwargs
Patch properties for the line drawn:
Property Description agg_filterunknown alphafloat or None animated[True | False] antialiasedor aa[True | False] or None for default axesan Axesinstancecapstyle[?butt? | ?round? | ?projecting?] clip_boxa matplotlib.transforms.Bboxinstanceclip_on[True | False] clip_path[ ( Path,Transform) |Patch| None ]colormatplotlib color spec containsa callable function edgecoloror ecmpl color spec, or None for default, or ?none? for no color facecoloror fcmpl color spec, or None for default, or ?none? for no color figurea matplotlib.figure.Figureinstancefill[True | False] gidan id string hatch[?/? | ?\? | ?|? | ?-? | ?+? | ?x? | ?o? | ?O? | ?.? | ?*?] joinstyle[?miter? | ?round? | ?bevel?] labelstring or anything printable with ?%s? conversion. linestyleor ls[?solid? | ?dashed?, ?dashdot?, ?dotted? | (offset, on-off-dash-seq) | '-'|'--'|'-.'|':'|'None'|' '|'']linewidthor lwfloat or None for default path_effectsunknown picker[None|float|boolean|callable] rasterized[True | False | None] sketch_paramsunknown snapunknown transformTransforminstanceurla url string visible[True | False] zorderany number -
get_path() -
Return the path of this patch
-
-
class mpl_toolkits.axes_grid1.inset_locator.BboxPatch(bbox, **kwargs) -
Bases:
matplotlib.patches.PatchPatch showing the shape bounded by a Bbox.
Parameters: bbox :
matplotlib.transforms.BboxBbox to use for the extents of this patch.
**kwargs
Patch properties. Valid arguments include:
Property Description agg_filterunknown alphafloat or None animated[True | False] antialiasedor aa[True | False] or None for default axesan Axesinstancecapstyle[?butt? | ?round? | ?projecting?] clip_boxa matplotlib.transforms.Bboxinstanceclip_on[True | False] clip_path[ ( Path,Transform) |Patch| None ]colormatplotlib color spec containsa callable function edgecoloror ecmpl color spec, or None for default, or ?none? for no color facecoloror fcmpl color spec, or None for default, or ?none? for no color figurea matplotlib.figure.Figureinstancefill[True | False] gidan id string hatch[?/? | ?\? | ?|? | ?-? | ?+? | ?x? | ?o? | ?O? | ?.? | ?*?] joinstyle[?miter? | ?round? | ?bevel?] labelstring or anything printable with ?%s? conversion. linestyleor ls[?solid? | ?dashed?, ?dashdot?, ?dotted? | (offset, on-off-dash-seq) | '-'|'--'|'-.'|':'|'None'|' '|'']linewidthor lwfloat or None for default path_effectsunknown picker[None|float|boolean|callable] rasterized[True | False | None] sketch_paramsunknown snapunknown transformTransforminstanceurla url string visible[True | False] zorderany number -
get_path() -
Return the path of this patch
-
-
class mpl_toolkits.axes_grid1.inset_locator.InsetPosition(parent, lbwh) -
Bases:
objectAn 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.AxesAxes 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
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)
-
mpl_toolkits.axes_grid1.inset_locator.inset_axes(parent_axes, width, height, loc=1, bbox_to_anchor=None, bbox_transform=None, axes_class=None, axes_kwargs=None, borderpad=0.5) -
Create an inset axes with a given width and height.
Both sizes used can be specified either in inches or percentage of the parent axes.
Parameters: parent_axes :
matplotlib.axes.AxesAxes to place the inset axes.
width, height : float or str
Size of the inset axes to create.
loc : int or string, optional, default to 1
Location to place the inset axes. The valid locations are:
'upper right' : 1, 'upper left' : 2, 'lower left' : 3, 'lower right' : 4, 'right' : 5, 'center left' : 6, 'center right' : 7, 'lower center' : 8, 'upper center' : 9, 'center' : 10
bbox_to_anchor : tuple or
matplotlib.transforms.BboxBase, optionalBbox that the inset axes will be anchored. Can be a tuple of [left, bottom, width, height], or a tuple of [left, bottom].
bbox_transform :
matplotlib.transforms.Transform, optionalTransformation for the bbox. if None,
parent_axes.transAxesis used.axes_class :
matplotlib.axes.Axestype, optionalIf specified, the inset axes created with be created with this class?s constructor.
axes_kwargs : dict, optional
Keyworded arguments to pass to the constructor of the inset axes. Valid arguments include:
Property Description adjustable[ ?box? | ?datalim? | ?box-forced?] agg_filterunknown alphafloat (0.0 transparent through 1.0 opaque) anchorunknown animated[True | False] aspectunknown autoscale_onunknown autoscalex_onunknown autoscaley_onunknown axesan Axesinstanceaxes_locatorunknown axis_bgcolorany matplotlib color - see colors()axisbelow[ True | False ] clip_boxa matplotlib.transforms.Bboxinstanceclip_on[True | False] clip_path[ ( Path,Transform) |Patch| None ]color_cycleunknown containsa callable function figureunknown frame_on[ True | False ] gidan id string labelstring or anything printable with ?%s? conversion. navigate[ True | False ] navigate_modeunknown path_effectsunknown picker[None|float|boolean|callable] positionunknown rasterization_zorderunknown rasterized[True | False | None] sketch_paramsunknown snapunknown titleunknown transformTransforminstanceurla url string visible[True | False] xboundunknown xlabelunknown xlimlength 2 sequence of floats xmarginunknown xscale[?linear? | ?log? | ?logit? | ?symlog?] xticklabelssequence of strings xtickssequence of floats yboundunknown ylabelunknown ylimlength 2 sequence of floats ymarginunknown yscale[?linear? | ?log? | ?logit? | ?symlog?] yticklabelssequence of strings ytickssequence of floats zorderany number borderpad : float, optional
Padding between inset axes and the bbox_to_anchor. Defaults to 0.5.
Returns: inset_axes :
axes_classInset axes object created.
-
mpl_toolkits.axes_grid1.inset_locator.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.AxesAxes which contains the area of the inset axes.
inset_axes :
matplotlib.axes.AxesThe inset axes.
loc1, loc2 : {1, 2, 3, 4}
Corners to use for connecting the inset axes and the area in the parent axes.
**kwargs
Patch properties for the lines and box drawn:
Property Description agg_filterunknown alphafloat or None animated[True | False] antialiasedor aa[True | False] or None for default axesan Axesinstancecapstyle[?butt? | ?round? | ?projecting?] clip_boxa matplotlib.transforms.Bboxinstanceclip_on[True | False] clip_path[ ( Path,Transform) |Patch| None ]colormatplotlib color spec containsa callable function edgecoloror ecmpl color spec, or None for default, or ?none? for no color facecoloror fcmpl color spec, or None for default, or ?none? for no color figurea matplotlib.figure.Figureinstancefill[True | False] gidan id string hatch[?/? | ?\? | ?|? | ?-? | ?+? | ?x? | ?o? | ?O? | ?.? | ?*?] joinstyle[?miter? | ?round? | ?bevel?] labelstring or anything printable with ?%s? conversion. linestyleor ls[?solid? | ?dashed?, ?dashdot?, ?dotted? | (offset, on-off-dash-seq) | '-'|'--'|'-.'|':'|'None'|' '|'']linewidthor lwfloat or None for default path_effectsunknown picker[None|float|boolean|callable] rasterized[True | False | None] sketch_paramsunknown snapunknown transformTransforminstanceurla url string visible[True | False] zorderany number Returns: pp :
matplotlib.patches.PatchThe patch drawn to represent the area of the inset axes.
p1, p2 :
matplotlib.patches.PatchThe patches connecting two corners of the inset axes and its area.
-
mpl_toolkits.axes_grid1.inset_locator.zoomed_inset_axes(parent_axes, zoom, loc=1, bbox_to_anchor=None, bbox_transform=None, axes_class=None, axes_kwargs=None, borderpad=0.5) -
Create an anchored inset axes by scaling a parent axes.
Parameters: parent_axes :
matplotlib.axes.AxesAxes to place the inset axes.
zoom : float
Scaling factor of the data axes. zoom > 1 will enlargen the coordinates (i.e., ?zoomed in?), while zoom < 1 will shrink the coordinates (i.e., ?zoomed out?).
loc : int or string, optional, default to 1
Location to place the inset axes. The valid locations are:
'upper right' : 1, 'upper left' : 2, 'lower left' : 3, 'lower right' : 4, 'right' : 5, 'center left' : 6, 'center right' : 7, 'lower center' : 8, 'upper center' : 9, 'center' : 10
bbox_to_anchor : tuple or
matplotlib.transforms.BboxBase, optionalBbox that the inset axes will be anchored. Can be a tuple of [left, bottom, width, height], or a tuple of [left, bottom].
bbox_transform :
matplotlib.transforms.Transform, optionalTransformation for the bbox. if None,
parent_axes.transAxesis used.axes_class :
matplotlib.axes.Axestype, optionalIf specified, the inset axes created with be created with this class?s constructor.
axes_kwargs : dict, optional
Keyworded arguments to pass to the constructor of the inset axes. Valid arguments include:
Property Description adjustable[ ?box? | ?datalim? | ?box-forced?] agg_filterunknown alphafloat (0.0 transparent through 1.0 opaque) anchorunknown animated[True | False] aspectunknown autoscale_onunknown autoscalex_onunknown autoscaley_onunknown axesan Axesinstanceaxes_locatorunknown axis_bgcolorany matplotlib color - see colors()axisbelow[ True | False ] clip_boxa matplotlib.transforms.Bboxinstanceclip_on[True | False] clip_path[ ( Path,Transform) |Patch| None ]color_cycleunknown containsa callable function figureunknown frame_on[ True | False ] gidan id string labelstring or anything printable with ?%s? conversion. navigate[ True | False ] navigate_modeunknown path_effectsunknown picker[None|float|boolean|callable] positionunknown rasterization_zorderunknown rasterized[True | False | None] sketch_paramsunknown snapunknown titleunknown transformTransforminstanceurla url string visible[True | False] xboundunknown xlabelunknown xlimlength 2 sequence of floats xmarginunknown xscale[?linear? | ?log? | ?logit? | ?symlog?] xticklabelssequence of strings xtickssequence of floats yboundunknown ylabelunknown ylimlength 2 sequence of floats ymarginunknown yscale[?linear? | ?log? | ?logit? | ?symlog?] yticklabelssequence of strings ytickssequence of floats zorderany number borderpad : float, optional
Padding between inset axes and the bbox_to_anchor. Defaults to 0.5.
Returns: inset_axes :
axes_classInset axes object created.
Please login to continue.