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

Method test_1d_x_y_kw

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

Source from the content-addressed store, hash-verified

232 xr.ones_like(self.darray[:, 0, 0], dtype=bool).plot() # type: ignore[call-arg]
233
234 def test_1d_x_y_kw(self) -> None:
235 z = np.arange(10)
236 da = DataArray(np.cos(z), dims=["z"], coords=[z], name="f")
237
238 xy: list[list[str | None]] = [[None, None], [None, "z"], ["z", None]]
239
240 _f, axs = plt.subplots(3, 1, squeeze=False)
241 for aa, (x, y) in enumerate(xy):
242 da.plot(x=x, y=y, ax=axs.flat[aa]) # type: ignore[call-arg]
243
244 with pytest.raises(ValueError, match=r"Cannot specify both"):
245 da.plot(x="z", y="z") # type: ignore[call-arg]
246
247 error_msg = "must be one of None, 'z'"
248 with pytest.raises(ValueError, match=rf"x {error_msg}"):
249 da.plot(x="f") # type: ignore[call-arg]
250
251 with pytest.raises(ValueError, match=rf"y {error_msg}"):
252 da.plot(y="f") # type: ignore[call-arg]
253
254 def test_multiindex_level_as_coord(self) -> None:
255 da = xr.DataArray(

Callers

nothing calls this directly

Calls 3

DataArrayClass · 0.90
arangeMethod · 0.80
plotMethod · 0.80

Tested by

no test coverage detected