Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use masked stack to preserve mask info#24732

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
rcomer merged 3 commits intomatplotlib:mainfromchahak13:24545_scatter_mask_datetime
Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletionlib/matplotlib/collections.py
View file
Open in desktop
Original file line numberDiff line numberDiff 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.
20 changes: 20 additions & 0 deletionslib/matplotlib/tests/test_collections.py
View file
Open in desktop
Original file line numberDiff line numberDiff 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 DownExpand 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)

[8]ページ先頭

©2009-2025 Movatter.jp