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

Method test_datetime_plot2d

xarray/tests/test_plot.py:3062–3079  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3060 assert type(ax.xaxis.get_major_locator()) is mpl.dates.AutoDateLocator
3061
3062 def test_datetime_plot2d(self) -> None:
3063 # Test that matplotlib-native datetime works:
3064 da = DataArray(
3065 np.arange(3 * 4).reshape(3, 4),
3066 dims=("x", "y"),
3067 coords={
3068 "x": [1, 2, 3],
3069 "y": [np.datetime64(f"2000-01-{x:02d}") for x in range(1, 5)],
3070 },
3071 )
3072
3073 p = da.plot.pcolormesh()
3074 ax = p.axes
3075 assert ax is not None
3076
3077 # Make sure only mpl converters are used, use type() so only
3078 # mpl.dates.AutoDateLocator passes and no other subclasses:
3079 assert type(ax.xaxis.get_major_locator()) is mpl.dates.AutoDateLocator
3080
3081
3082@pytest.mark.filterwarnings("ignore:setting an array element with a sequence")

Callers

nothing calls this directly

Calls 4

DataArrayClass · 0.90
typeFunction · 0.85
arangeMethod · 0.80
pcolormeshMethod · 0.80

Tested by

no test coverage detected