FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Use masked stack to preserve mask info by chahak13 · Pull Request #24732 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .png  (1) .py  (2) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 1 addition & 1 deletion lib/matplotlib/collections.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def _prepare_points(self):
paths.append(mpath.Path(np.column_stack([xs, ys]), path.codes))
xs = self.convert_xunits(offsets[:, 0])
ys = self.convert_yunits(offsets[:, 1])
offsets = np.column_stack([xs, ys])
offsets = np.ma.column_stack([xs, ys])

if not transform.is_affine:
paths = [transform.transform_path_non_affine(path)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
20 changes: 20 additions & 0 deletions lib/matplotlib/tests/test_collections.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import io
from types import SimpleNamespace
from datetime import datetime

import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
Expand Down Expand Up @@ -1129,3 +1130,22 @@ def test_set_offset_units():
off0 = sc.get_offsets()
sc.set_offsets(list(zip(y, d)))
np.testing.assert_allclose(off0, sc.get_offsets())


@image_comparison(baseline_images=["test_check_masked_offsets"],
extensions=["png"], remove_text=True, style="mpl20")
def test_check_masked_offsets():
# Check if masked data is respected by scatter
# Ref: Issue #24545
unmasked_x = [
datetime(2022, 12, 15, 4, 49, 52),
datetime(2022, 12, 15, 4, 49, 53),
datetime(2022, 12, 15, 4, 49, 54),
datetime(2022, 12, 15, 4, 49, 55),
datetime(2022, 12, 15, 4, 49, 56),
]

masked_y = np.ma.array([1, 2, 3, 4, 5], mask=[0, 1, 1, 0, 0])

fig, ax = plt.subplots()
ax.scatter(unmasked_x, masked_y)

Back | FazBrowse Home | New Git URL