MCPcopy Create free account
hub / github.com/plotly/plotly.py / test_imshow_xarray_facet_row

Function test_imshow_xarray_facet_row

tests/test_optional/test_px/test_imshow.py:524–537  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

522
523
524def test_imshow_xarray_facet_row():
525 img = np.random.random((3, 4, 5))
526 da = xr.DataArray(
527 img, dims=["row_dim", "dim_1", "dim_2"], coords={"row_dim": ["A", "B", "C"]}
528 )
529 fig = px.imshow(da, facet_row="row_dim")
530 # Dimensions are used for axis labels and coordinates
531 assert fig.layout.xaxis.title.text == "dim_2"
532 assert fig.layout.yaxis.title.text == "dim_1"
533 assert np.all(np.array(fig.data[0].x) == np.array(da.coords["dim_2"]))
534 assert len(fig.data) == 3
535 # Check row labels are present
536 annotations = [a.text for a in fig.layout.annotations]
537 assert any("row_dim=A" in a for a in annotations)
538
539
540def test_imshow_xarray_facet_row_and_col():

Callers

nothing calls this directly

Calls 1

arrayMethod · 0.45

Tested by

no test coverage detected