Skip to content

Commit e401f82

Browse files
authored
Merge pull request matplotlib#30479 from anntzer/ilia
Clarify inset_locator.inset_axes demo.
2 parents 21cd325 + 84436f0 commit e401f82

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

galleries/examples/axes_grid1/demo_colorbar_with_inset_locator.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
"""
22
.. _demo-colorbar-with-inset-locator:
33
4-
===========================================================
5-
Control the position and size of a colorbar with Inset Axes
6-
===========================================================
4+
=========================================================================
5+
Control the position and size of a colorbar with inset_locator.inset_axes
6+
=========================================================================
77
88
This example shows how to control the position, height, and width of colorbars
9-
using `~mpl_toolkits.axes_grid1.inset_locator.inset_axes`.
9+
using `.inset_locator.inset_axes`.
1010
11-
Inset Axes placement is controlled as for legends: either by providing a *loc*
12-
option ("upper right", "best", ...), or by providing a locator with respect to
13-
the parent bbox. Parameters such as *bbox_to_anchor* and *borderpad* likewise
14-
work in the same way, and are also demonstrated here.
11+
`.inset_locator.inset_axes` placement is controlled as for legends: either
12+
by providing a *loc* option ("upper right", "best", ...), or by providing a
13+
locator with respect to the parent bbox. Parameters such as *bbox_to_anchor*
14+
and *borderpad* likewise work in the same way, and are also demonstrated here.
1515
1616
Users should consider using `.Axes.inset_axes` instead (see
1717
:ref:`colorbar_placement`).
@@ -21,12 +21,12 @@
2121

2222
import matplotlib.pyplot as plt
2323

24-
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
24+
from mpl_toolkits.axes_grid1 import inset_locator
2525

2626
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=[6, 3])
2727

2828
im1 = ax1.imshow([[1, 2], [2, 3]])
29-
axins1 = inset_axes(
29+
axins1 = inset_locator.inset_axes(
3030
ax1,
3131
width="50%", # width: 50% of parent_bbox width
3232
height="5%", # height: 5%
@@ -36,7 +36,7 @@
3636
fig.colorbar(im1, cax=axins1, orientation="horizontal", ticks=[1, 2, 3])
3737

3838
im = ax2.imshow([[1, 2], [2, 3]])
39-
axins = inset_axes(
39+
axins = inset_locator.inset_axes(
4040
ax2,
4141
width="5%", # width: 5% of parent_bbox width
4242
height="50%", # height: 50%

0 commit comments

Comments
 (0)