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

Skip to content

Commit 6586784

Browse files
authored
Merge pull request #23902 from oscargus/mpltoolkitsfixes
Add test and improve examples for mpl_toolkits
2 parents 650f55e + 4ee99e3 commit 6586784

File tree

5 files changed

+19
-7
lines changed

5 files changed

+19
-7
lines changed

examples/axes_grid1/inset_locator_demo2.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
"""
2-
===================
3-
Inset Locator Demo2
4-
===================
2+
====================
3+
Inset Locator Demo 2
4+
====================
55
66
This Demo shows how to create a zoomed inset via `.zoomed_inset_axes`.
77
In the first subplot an `.AnchoredSizeBar` shows the zoom effect.
88
In the second subplot a connection to the region of interest is
99
created via `.mark_inset`.
10+
11+
A version of the second subplot, not using the toolkit, is available in
12+
:doc:`/gallery/subplots_axes_and_figures/zoom_inset_axes`.
1013
"""
1114

1215
from matplotlib import cbook

examples/axisartist/demo_floating_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
the plot.
1010
* Using `~.floating_axes.GridHelperCurveLinear` to rotate the plot and set the
1111
plot boundary.
12-
* Using `~.floating_axes.FloatingSubplot` to create a subplot using the return
13-
value from `~.floating_axes.GridHelperCurveLinear`.
12+
* Using `~.Figure.add_subplot` to create a subplot using the return value from
13+
`~.floating_axes.GridHelperCurveLinear`.
1414
* Making a sector plot by adding more features to
1515
`~.floating_axes.GridHelperCurveLinear`.
1616
"""

lib/mpl_toolkits/axes_grid1/inset_locator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def __init__(self, parent, lbwh):
4343
4444
>>> parent_axes = plt.gca()
4545
>>> ax_ins = plt.axes([0, 0, 1, 1])
46-
>>> ip = InsetPosition(ax, [0.5, 0.1, 0.4, 0.2])
46+
>>> ip = InsetPosition(parent_axes, [0.5, 0.1, 0.4, 0.2])
4747
>>> ax_ins.set_axes_locator(ip)
4848
"""
4949
self.parent = parent

lib/mpl_toolkits/tests/test_axes_grid1.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
Divider, HBoxDivider, make_axes_area_auto_adjustable)
2222
from mpl_toolkits.axes_grid1.axes_rgb import RGBAxes
2323
from mpl_toolkits.axes_grid1.inset_locator import (
24-
zoomed_inset_axes, mark_inset, inset_axes, BboxConnectorPatch)
24+
zoomed_inset_axes, mark_inset, inset_axes, BboxConnectorPatch,
25+
InsetPosition)
2526
import mpl_toolkits.axes_grid1.mpl_axes
2627

2728
import pytest
@@ -571,6 +572,14 @@ def test_rgb_axes():
571572
ax.imshow_rgb(r, g, b, interpolation='none')
572573

573574

575+
@image_comparison(['insetposition.png'], remove_text=True)
576+
def test_insetposition():
577+
fig, ax = plt.subplots(figsize=(2, 2))
578+
ax_ins = plt.axes([0, 0, 1, 1])
579+
ip = InsetPosition(ax, [0.2, 0.25, 0.5, 0.4])
580+
ax_ins.set_axes_locator(ip)
581+
582+
574583
# The original version of this test relied on mpl_toolkits's slightly different
575584
# colorbar implementation; moving to matplotlib's own colorbar implementation
576585
# caused the small image comparison error.

0 commit comments

Comments
 (0)