MCPcopy Index your code
hub / github.com/pydata/xarray / test_maybe_gca

Function test_maybe_gca

xarray/tests/test_plot.py:3363–3385  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3361
3362@requires_matplotlib
3363def test_maybe_gca() -> None:
3364 with figure_context():
3365 ax = _maybe_gca(aspect=1)
3366
3367 assert isinstance(ax, mpl.axes.Axes)
3368 assert ax.get_aspect() == 1
3369
3370 with figure_context():
3371 # create figure without axes
3372 plt.figure()
3373 ax = _maybe_gca(aspect=1)
3374
3375 assert isinstance(ax, mpl.axes.Axes)
3376 assert ax.get_aspect() == 1
3377
3378 with figure_context():
3379 existing_axes = plt.axes()
3380 ax = _maybe_gca(aspect=1)
3381
3382 # reuses the existing axes
3383 assert existing_axes == ax
3384 # kwargs are ignored when reusing axes
3385 assert ax.get_aspect() == "auto"
3386
3387
3388@requires_matplotlib

Callers

nothing calls this directly

Calls 3

_maybe_gcaFunction · 0.90
figure_contextFunction · 0.85
axesMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…