()
| 3501 | |
| 3502 | @requires_matplotlib |
| 3503 | def test_plot1d_default_rcparams() -> None: |
| 3504 | import matplotlib as mpl |
| 3505 | |
| 3506 | ds = xr.tutorial.scatter_example_dataset(seed=42) |
| 3507 | |
| 3508 | with figure_context(): |
| 3509 | # scatter markers should by default have white edgecolor to better |
| 3510 | # see overlapping markers: |
| 3511 | _fig, ax = plt.subplots(1, 1) |
| 3512 | ds.plot.scatter(x="A", y="B", marker="o", ax=ax) |
| 3513 | actual: np.ndarray = mpl.colors.to_rgba_array("w") |
| 3514 | expected: np.ndarray = ax.collections[0].get_edgecolor() # type: ignore[assignment] |
| 3515 | np.testing.assert_allclose(actual, expected) |
| 3516 | |
| 3517 | # Facetgrids should have the default value as well: |
| 3518 | fg = ds.plot.scatter(x="A", y="B", col="x", marker="o") |
| 3519 | ax = fg.axs.ravel()[0] |
| 3520 | actual = mpl.colors.to_rgba_array("w") |
| 3521 | expected = ax.collections[0].get_edgecolor() # type: ignore[assignment,unused-ignore] |
| 3522 | np.testing.assert_allclose(actual, expected) |
| 3523 | |
| 3524 | # scatter should not emit any warnings when using unfilled markers: |
| 3525 | with assert_no_warnings(): |
| 3526 | _fig, ax = plt.subplots(1, 1) |
| 3527 | ds.plot.scatter(x="A", y="B", ax=ax, marker="x") |
| 3528 | |
| 3529 | # Prioritize edgecolor argument over default plot1d values: |
| 3530 | _fig, ax = plt.subplots(1, 1) |
| 3531 | ds.plot.scatter(x="A", y="B", marker="o", ax=ax, edgecolor="k") |
| 3532 | actual = mpl.colors.to_rgba_array("k") |
| 3533 | expected = ax.collections[0].get_edgecolor() # type: ignore[assignment] |
| 3534 | np.testing.assert_allclose(actual, expected) |
| 3535 | |
| 3536 | |
| 3537 | @requires_matplotlib |
nothing calls this directly
no test coverage detected
searching dependent graphs…