MCPcopy
hub / github.com/matplotlib/matplotlib / inset_axes

Method inset_axes

lib/matplotlib/axes/_axes.py:359–429  ·  view source on GitHub ↗

Add a child inset Axes to this existing Axes. Parameters ---------- bounds : [x0, y0, width, height] Lower-left corner of inset Axes, and its width and height. transform : `.Transform` Defaults to `!ax.transAxes`, i.e. the units of

(self, bounds, *, transform=None, zorder=5, **kwargs)

Source from the content-addressed store, hash-verified

357 self.legend_ = None
358
359 def inset_axes(self, bounds, *, transform=None, zorder=5, **kwargs):
360 """
361 Add a child inset Axes to this existing Axes.
362
363
364 Parameters
365 ----------
366 bounds : [x0, y0, width, height]
367 Lower-left corner of inset Axes, and its width and height.
368
369 transform : `.Transform`
370 Defaults to `!ax.transAxes`, i.e. the units of *rect* are in
371 Axes-relative coordinates.
372
373 projection : {None, 'aitoff', 'hammer', 'lambert', 'mollweide', \
374'polar', 'rectilinear', str}, optional
375 The projection type of the inset `~.axes.Axes`. *str* is the name
376 of a custom projection, see `~matplotlib.projections`. The default
377 None results in a 'rectilinear' projection.
378
379 polar : bool, default: False
380 If True, equivalent to projection='polar'.
381
382 axes_class : subclass type of `~.axes.Axes`, optional
383 The `.axes.Axes` subclass that is instantiated. This parameter
384 is incompatible with *projection* and *polar*. See
385 :ref:`axisartist_users-guide-index` for examples.
386
387 zorder : number
388 Defaults to 5 (same as `.Axes.legend`). Adjust higher or lower
389 to change whether it is above or below data plotted on the
390 parent Axes.
391
392 **kwargs
393 Other keyword arguments are passed on to the inset Axes class.
394
395 Returns
396 -------
397 ax
398 The created `~.axes.Axes` instance.
399
400 Examples
401 --------
402 This example makes two inset Axes, the first is in Axes-relative
403 coordinates, and the second in data-coordinates::
404
405 fig, ax = plt.subplots()
406 ax.plot(range(10))
407 axin1 = ax.inset_axes([0.8, 0.1, 0.15, 0.15])
408 axin2 = ax.inset_axes(
409 [5, 7, 2.3, 2.3], transform=ax.transData)
410
411 """
412 if transform is None:
413 transform = self.transAxes
414 kwargs.setdefault('label', 'inset_axes')
415
416 # This puts the rectangle into figure-relative coordinates.

Callers 15

test_span_selectorFunction · 0.80
test_inset_and_secondaryFunction · 0.80
test_integration_optionsFunction · 0.80
test_passing_locationFunction · 0.80
test_colorbar_errorsFunction · 0.80
test_title_inset_axFunction · 0.80
test_zoom_insetFunction · 0.80
test_inset_polarFunction · 0.80
test_inset_projectionFunction · 0.80
test_inset_subclassFunction · 0.80

Calls 5

add_child_axesMethod · 0.80
get_figureMethod · 0.45
set_axes_locatorMethod · 0.45

Tested by 15

test_span_selectorFunction · 0.64
test_inset_and_secondaryFunction · 0.64
test_integration_optionsFunction · 0.64
test_passing_locationFunction · 0.64
test_colorbar_errorsFunction · 0.64
test_title_inset_axFunction · 0.64
test_zoom_insetFunction · 0.64
test_inset_polarFunction · 0.64
test_inset_projectionFunction · 0.64
test_inset_subclassFunction · 0.64