Skip to content

closes #26477 ENH: Add interpolation_stage in qt figureoptions #26500

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 10 additions & 2 deletions lib/matplotlib/backends/qt_editor/figureoptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ def prepare_data(d, init):
mappabledata.append((
'Interpolation',
[mappable.get_interpolation(), *interpolations]))

interpolation_stages = ['data', 'rgba']
mappabledata.append((
'Interpolation stage',
[mappable.get_interpolation_stage(), *interpolation_stages]))

mappables.append([mappabledata, label, ""])
# Is there a scalarmappable displayed?
has_sm = bool(mappables)
Expand Down Expand Up @@ -227,9 +233,11 @@ def apply_callback(data):
# Set ScalarMappables.
for index, mappable_settings in enumerate(mappables):
mappable = labeled_mappables[index][1]
if len(mappable_settings) == 5:
label, cmap, low, high, interpolation = mappable_settings
if len(mappable_settings) == 6:
label, cmap, low, high, interpolation, interpolation_stage = \
mappable_settings
mappable.set_interpolation(interpolation)
mappable.set_interpolation_stage(interpolation_stage)
elif len(mappable_settings) == 4:
label, cmap, low, high = mappable_settings
mappable.set_label(label)
Expand Down
8 changes: 8 additions & 0 deletions lib/matplotlib/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,14 @@ def set_interpolation(self, s):
self._interpolation = s
self.stale = True

def get_interpolation_stage(self):
"""
Return when interpolation happens during the transform to RGBA.

One of 'data', 'rgba'.
"""
return self._interpolation_stage

def set_interpolation_stage(self, s):
"""
Set when interpolation happens during the transform to RGBA.
Expand Down
1 change: 1 addition & 0 deletions lib/matplotlib/image.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class _ImageBase(martist.Artist, cm.ScalarMappable):
def get_shape(self) -> tuple[int, int, int]: ...
def get_interpolation(self) -> str: ...
def set_interpolation(self, s: str | None) -> None: ...
def get_interpolation_stage(self) -> Literal["data", "rgba"]: ...
def set_interpolation_stage(self, s: Literal["data", "rgba"]) -> None: ...
def can_composite(self) -> bool: ...
def set_resample(self, v: bool | None) -> None: ...
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy