| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -322,7 +322,7 @@ def _prepare_points(self): | |||
| 322 | 322 | paths.append(mpath.Path(np.column_stack([xs, ys]), path.codes)) | |
| 323 | 323 | xs = self.convert_xunits(offsets[:, 0]) | |
| 324 | 324 | ys = self.convert_yunits(offsets[:, 1]) | |
| 325 | - offsets = np.column_stack([xs, ys]) | ||
| 325 | + offsets = np.ma.column_stack([xs, ys]) | ||
| 326 | 326 | ||
| 327 | 327 | if not transform.is_affine: | |
| 328 | 328 | paths = [transform.transform_path_non_affine(path) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,6 @@ | |||
| 1 | 1 | import io | |
| 2 | 2 | from types import SimpleNamespace | |
| 3 | + from datetime import datetime | ||
| 3 | 4 | ||
| 4 | 5 | import numpy as np | |
| 5 | 6 | from numpy.testing import assert_array_equal, assert_array_almost_equal | |
@@ -1129,3 +1130,22 @@ def test_set_offset_units(): | |||
| 1129 | 1130 | off0 = sc.get_offsets() | |
| 1130 | 1131 | sc.set_offsets(list(zip(y, d))) | |
| 1131 | 1132 | np.testing.assert_allclose(off0, sc.get_offsets()) | |
| 1133 | + | ||
| 1134 | + | ||
| 1135 | + @image_comparison(baseline_images=["test_check_masked_offsets"], | ||
| 1136 | + extensions=["png"], remove_text=True, style="mpl20") | ||
| 1137 | + def test_check_masked_offsets(): | ||
| 1138 | + # Check if masked data is respected by scatter | ||
| 1139 | + # Ref: Issue #24545 | ||
| 1140 | + unmasked_x = [ | ||
| 1141 | + datetime(2022, 12, 15, 4, 49, 52), | ||
| 1142 | + datetime(2022, 12, 15, 4, 49, 53), | ||
| 1143 | + datetime(2022, 12, 15, 4, 49, 54), | ||
| 1144 | + datetime(2022, 12, 15, 4, 49, 55), | ||
| 1145 | + datetime(2022, 12, 15, 4, 49, 56), | ||
| 1146 | + ] | ||
| 1147 | + | ||
| 1148 | + masked_y = np.ma.array([1, 2, 3, 4, 5], mask=[0, 1, 1, 0, 0]) | ||
| 1149 | + | ||
| 1150 | + fig, ax = plt.subplots() | ||
| 1151 | + ax.scatter(unmasked_x, masked_y) | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments