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

Function _maybe_gca

xarray/plot/utils.py:506–517  ·  view source on GitHub ↗
(**subplot_kws: Any)

Source from the content-addressed store, hash-verified

504
505
506def _maybe_gca(**subplot_kws: Any) -> Axes:
507 import matplotlib.pyplot as plt
508
509 # can call gcf unconditionally: either it exists or would be created by plt.axes
510 f = plt.gcf()
511
512 # only call gca if an active axes exists
513 if f.axes:
514 # can not pass kwargs to active axes
515 return plt.gca()
516
517 return plt.axes(**subplot_kws)
518
519
520def _get_units_from_attrs(da: DataArray) -> str:

Callers 2

test_maybe_gcaFunction · 0.90
get_axisFunction · 0.85

Calls 1

axesMethod · 0.80

Tested by 1

test_maybe_gcaFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…