| 522 | |
| 523 | |
| 524 | def 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 | |
| 540 | def test_imshow_xarray_facet_row_and_col(): |