|
7 | 7 |
|
8 | 8 | # %%
|
9 | 9 | # The `.inset_locator`'s `~.inset_locator.inset_axes` allows
|
10 |
| -# easily placing insets in the corners of the axes by specifying a width and |
| 10 | +# easily placing insets in the corners of the Axes by specifying a width and |
11 | 11 | # height and optionally a location (loc) that accepts locations as codes,
|
12 | 12 | # similar to `~matplotlib.axes.Axes.legend`.
|
13 | 13 | # By default, the inset is offset by some points from the axes,
|
|
23 | 23 | # at the default upper right location
|
24 | 24 | axins = inset_axes(ax, width=1.3, height=0.9)
|
25 | 25 |
|
26 |
| -# Create inset of width 30% and height 40% of the parent axes' bounding box |
| 26 | +# Create inset of width 30% and height 40% of the parent Axes' bounding box |
27 | 27 | # at the lower left corner (loc=3)
|
28 | 28 | axins2 = inset_axes(ax, width="30%", height="40%", loc=3)
|
29 | 29 |
|
30 | 30 | # Create inset of mixed specifications in the second subplot;
|
31 |
| -# width is 30% of parent axes' bounding box and |
| 31 | +# width is 30% of parent Axes' bounding box and |
32 | 32 | # height is 1 inch at the upper left corner (loc=2)
|
33 | 33 | axins3 = inset_axes(ax2, width="30%", height=1., loc=2)
|
34 | 34 |
|
35 | 35 | # Create an inset in the lower right corner (loc=4) with borderpad=1, i.e.
|
36 |
| -# 10 points padding (as 10pt is the default fontsize) to the parent axes |
| 36 | +# 10 points padding (as 10pt is the default fontsize) to the parent Axes |
37 | 37 | axins4 = inset_axes(ax2, width="20%", height="20%", loc=4, borderpad=1)
|
38 | 38 |
|
39 | 39 | # Turn ticklabels of insets off
|
|
54 | 54 | fig = plt.figure(figsize=[5.5, 2.8])
|
55 | 55 | ax = fig.add_subplot(121)
|
56 | 56 |
|
57 |
| -# We use the axes transform as bbox_transform. Therefore, the bounding box |
| 57 | +# We use the Axes transform as bbox_transform. Therefore, the bounding box |
58 | 58 | # needs to be specified in axes coordinates ((0, 0) is the lower left corner
|
59 |
| -# of the axes, (1, 1) is the upper right corner). |
| 59 | +# of the Axes, (1, 1) is the upper right corner). |
60 | 60 | # The bounding box (.2, .4, .6, .5) starts at (.2, .4) and ranges to (.8, .9)
|
61 | 61 | # in those coordinates.
|
62 | 62 | # Inside this bounding box an inset of half the bounding box' width and
|
|
78 | 78 |
|
79 | 79 |
|
80 | 80 | # Note how the two following insets are created at the same positions, one by
|
81 |
| -# use of the default parent axes' bbox and the other via a bbox in axes |
| 81 | +# use of the default parent Axes' bbox and the other via a bbox in Axes |
82 | 82 | # coordinates and the respective transform.
|
83 | 83 | ax2 = fig.add_subplot(222)
|
84 | 84 | axins2 = inset_axes(ax2, width="30%", height="50%")
|
|
101 | 101 |
|
102 | 102 |
|
103 | 103 | # %%
|
104 |
| -# In the above the axes transform together with 4-tuple bounding boxes has been |
105 |
| -# used as it mostly is useful to specify an inset relative to the axes it is |
| 104 | +# In the above the Axes transform together with 4-tuple bounding boxes has been |
| 105 | +# used as it mostly is useful to specify an inset relative to the Axes it is |
106 | 106 | # an inset to. However, other use cases are equally possible. The following
|
107 | 107 | # example examines some of those.
|
108 | 108 | #
|
109 | 109 |
|
110 | 110 | fig = plt.figure(figsize=[5.5, 2.8])
|
111 | 111 | ax = fig.add_subplot(131)
|
112 | 112 |
|
113 |
| -# Create an inset outside the axes |
| 113 | +# Create an inset outside the Axes |
114 | 114 | axins = inset_axes(ax, width="100%", height="100%",
|
115 | 115 | bbox_to_anchor=(1.05, .6, .5, .4),
|
116 | 116 | bbox_transform=ax.transAxes, loc=2, borderpad=0)
|
|
134 | 134 | bbox_transform=ax2.transData, loc=2, borderpad=0)
|
135 | 135 |
|
136 | 136 | # Create an inset horizontally centered in figure coordinates and vertically
|
137 |
| -# bound to line up with the axes. |
| 137 | +# bound to line up with the Axes. |
138 | 138 | from matplotlib.transforms import blended_transform_factory # noqa
|
139 | 139 |
|
140 | 140 | transform = blended_transform_factory(fig.transFigure, ax2.transAxes)
|
|
0 commit comments