From 43fcc54a38267f9f919ee4e38cfbd8535769a1a5 Mon Sep 17 00:00:00 2001 From: Rafael Tsuha Date: Fri, 11 Aug 2023 19:06:15 -0300 Subject: [PATCH 1/2] add getter for image interpolation_stage --- lib/matplotlib/image.py | 8 ++++++++ lib/matplotlib/image.pyi | 1 + 2 files changed, 9 insertions(+) diff --git a/lib/matplotlib/image.py b/lib/matplotlib/image.py index 73738fe3bdbe..3741c2cdecb3 100644 --- a/lib/matplotlib/image.py +++ b/lib/matplotlib/image.py @@ -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. diff --git a/lib/matplotlib/image.pyi b/lib/matplotlib/image.pyi index 20fdc3ff946a..4b684f693845 100644 --- a/lib/matplotlib/image.pyi +++ b/lib/matplotlib/image.pyi @@ -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: ... From 518d70f3032f0366ca8178ab1c6ccce0cdf7fb56 Mon Sep 17 00:00:00 2001 From: Rafael Tsuha Date: Fri, 11 Aug 2023 19:19:59 -0300 Subject: [PATCH 2/2] ENH: add interpolation_stage in qt figureoptions add interpolation_stage selector for images in qt figureoptions --- lib/matplotlib/backends/qt_editor/figureoptions.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/backends/qt_editor/figureoptions.py b/lib/matplotlib/backends/qt_editor/figureoptions.py index c744ccc3ca59..c36bbeb62641 100644 --- a/lib/matplotlib/backends/qt_editor/figureoptions.py +++ b/lib/matplotlib/backends/qt_editor/figureoptions.py @@ -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) @@ -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) 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