From c56b0c46652eeae84a6403b951361d0cc35e5720 Mon Sep 17 00:00:00 2001 From: Michael Waskom Date: Sun, 31 Jan 2021 19:57:49 -0500 Subject: [PATCH] Test bivariate normalization --- seaborn/tests/test_distributions.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/seaborn/tests/test_distributions.py b/seaborn/tests/test_distributions.py index ebb86db4e8..a2f8628e0e 100644 --- a/seaborn/tests/test_distributions.py +++ b/seaborn/tests/test_distributions.py @@ -1816,6 +1816,17 @@ def test_mesh_unique_norm(self, long_df): density, (x_edges, y_edges) = sub_hist(sub_df["x"], sub_df["y"]) assert_array_equal(mesh_data.data, density.T.flat) + @pytest.mark.parametrize("stat", ["probability", "percent"]) + def test_mesh_normalization(self, long_df, stat): + + ax = histplot( + long_df, x="x", y="y", stat=stat, + ) + + mesh_data = ax.collections[0].get_array() + expected_sum = {"probability": 1, "percent": 100}[stat] + assert mesh_data.data.sum() == expected_sum + def test_mesh_colors(self, long_df): color = "r"