forked from pool/python-matplotlib
Accepting request 927346 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/927346 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-matplotlib?expand=0&rev=90
This commit is contained in:
commit
bf3887b530
@ -1,22 +0,0 @@
|
||||
From 5a4f6f035339d3573aa7b1a0ba67dfd4efb8f568 Mon Sep 17 00:00:00 2001
|
||||
From: Jody Klymak <jklymak@gmail.com>
|
||||
Date: Thu, 1 Jul 2021 22:10:10 -0700
|
||||
Subject: [PATCH] FIX: PILLOW asarray bug
|
||||
|
||||
---
|
||||
lib/matplotlib/image.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/matplotlib/image.py b/lib/matplotlib/image.py
|
||||
index a59499cd966..b2c9c4b22f9 100644
|
||||
--- a/lib/matplotlib/image.py
|
||||
+++ b/lib/matplotlib/image.py
|
||||
@@ -1688,7 +1688,7 @@ def _pil_png_to_float_array(pil_png):
|
||||
mode = pil_png.mode
|
||||
rawmode = pil_png.png.im_rawmode
|
||||
if rawmode == "1": # Grayscale.
|
||||
- return np.asarray(pil_png, np.float32)
|
||||
+ return np.asarray(pil_png).astype(np.float32)
|
||||
if rawmode == "L;2": # Grayscale.
|
||||
return np.divide(pil_png, 2**2 - 1, dtype=np.float32)
|
||||
if rawmode == "L;4": # Grayscale.
|
@ -1,71 +0,0 @@
|
||||
From 48eef460e8c861321e6d6a08a86ef0e45a863b59 Mon Sep 17 00:00:00 2001
|
||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
Date: Thu, 24 Jun 2021 04:11:39 -0400
|
||||
Subject: [PATCH] Don't modify arrays when masking values for log.
|
||||
|
||||
NumPy 1.21.0 fixed a bug with `np.ma.masked_where` where `copy=False`
|
||||
now modifies the input if it is masked, which we do not want to do.
|
||||
`np.ma.array` defaults to not copying the data, but copies the mask
|
||||
(adding the new mask), which is what we wanted with `copy=False`.
|
||||
---
|
||||
lib/matplotlib/colors.py | 4 ++--
|
||||
lib/matplotlib/tests/test_image.py | 28 ++++++++++++++++++++++++++++
|
||||
2 files changed, 30 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py
|
||||
index e0c42c5b69d5..0f6bf35dc440 100644
|
||||
--- a/lib/matplotlib/colors.py
|
||||
+++ b/lib/matplotlib/colors.py
|
||||
@@ -1545,11 +1545,11 @@ class LogNorm(Normalize):
|
||||
|
||||
def autoscale(self, A):
|
||||
# docstring inherited.
|
||||
- super().autoscale(np.ma.masked_less_equal(A, 0, copy=False))
|
||||
+ super().autoscale(np.ma.array(A, mask=(A <= 0)))
|
||||
|
||||
def autoscale_None(self, A):
|
||||
# docstring inherited.
|
||||
- super().autoscale_None(np.ma.masked_less_equal(A, 0, copy=False))
|
||||
+ super().autoscale_None(np.ma.array(A, mask=(A <= 0)))
|
||||
|
||||
|
||||
@_make_norm_from_scale(
|
||||
diff --git a/lib/matplotlib/tests/test_image.py b/lib/matplotlib/tests/test_image.py
|
||||
index 42ed7479ae54..0e385ba7a805 100644
|
||||
--- a/lib/matplotlib/tests/test_image.py
|
||||
+++ b/lib/matplotlib/tests/test_image.py
|
||||
@@ -1233,6 +1233,34 @@ def test_imshow_quantitynd():
|
||||
fig.canvas.draw()
|
||||
|
||||
|
||||
+@check_figures_equal(extensions=['png'])
|
||||
+def test_norm_change(fig_test, fig_ref):
|
||||
+ # LogNorm should not mask anything invalid permanently.
|
||||
+ data = np.full((5, 5), 1, dtype=np.float64)
|
||||
+ data[0:2, :] = -1
|
||||
+
|
||||
+ masked_data = np.ma.array(data, mask=False)
|
||||
+ masked_data.mask[0:2, 0:2] = True
|
||||
+
|
||||
+ cmap = plt.get_cmap('viridis').with_extremes(under='w')
|
||||
+
|
||||
+ ax = fig_test.subplots()
|
||||
+ im = ax.imshow(data, norm=colors.LogNorm(vmin=0.5, vmax=1),
|
||||
+ extent=(0, 5, 0, 5), interpolation='nearest', cmap=cmap)
|
||||
+ im.set_norm(colors.Normalize(vmin=-2, vmax=2))
|
||||
+ im = ax.imshow(masked_data, norm=colors.LogNorm(vmin=0.5, vmax=1),
|
||||
+ extent=(5, 10, 5, 10), interpolation='nearest', cmap=cmap)
|
||||
+ im.set_norm(colors.Normalize(vmin=-2, vmax=2))
|
||||
+ ax.set(xlim=(0, 10), ylim=(0, 10))
|
||||
+
|
||||
+ ax = fig_ref.subplots()
|
||||
+ ax.imshow(data, norm=colors.Normalize(vmin=-2, vmax=2),
|
||||
+ extent=(0, 5, 0, 5), interpolation='nearest', cmap=cmap)
|
||||
+ ax.imshow(masked_data, norm=colors.Normalize(vmin=-2, vmax=2),
|
||||
+ extent=(5, 10, 5, 10), interpolation='nearest', cmap=cmap)
|
||||
+ ax.set(xlim=(0, 10), ylim=(0, 10))
|
||||
+
|
||||
+
|
||||
@check_figures_equal(extensions=['png'])
|
||||
def test_huge_range_log(fig_test, fig_ref):
|
||||
data = np.full((5, 5), -1, dtype=np.float64)
|
@ -1,25 +0,0 @@
|
||||
From 093fdeccef7e8195a31dfabfd4a4b5f1b07c96d5 Mon Sep 17 00:00:00 2001
|
||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
Date: Wed, 21 Jul 2021 22:18:54 -0400
|
||||
Subject: [PATCH] Fix tests with Inkscape 1.1.
|
||||
|
||||
The change is imperceptible, so just increase the tolerance.
|
||||
|
||||
Fixes #20617.
|
||||
---
|
||||
lib/matplotlib/tests/test_axes.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py
|
||||
index 2211962cdf01..a885afe70c91 100644
|
||||
--- a/lib/matplotlib/tests/test_axes.py
|
||||
+++ b/lib/matplotlib/tests/test_axes.py
|
||||
@@ -1372,7 +1372,7 @@ def test_markevery_line():
|
||||
ax.legend()
|
||||
|
||||
|
||||
-@image_comparison(['markevery_linear_scales'], remove_text=True)
|
||||
+@image_comparison(['markevery_linear_scales'], remove_text=True, tol=0.001)
|
||||
def test_markevery_linear_scales():
|
||||
cases = [None,
|
||||
8,
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d8d994cefdff9aaba45166eb3de4f5211adb4accac85cbf97137e98f26ea0219
|
||||
size 37308683
|
3
matplotlib-3.4.3.tar.gz
Normal file
3
matplotlib-3.4.3.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:fc4f526dfdb31c9bd6b8ca06bf9fab663ca12f3ec9cdf4496fb44bc680140318
|
||||
size 37850796
|
@ -1,3 +1,12 @@
|
||||
-------------------------------------------------------------------
|
||||
Sat Oct 23 15:49:11 UTC 2021 - Axel Braun <axel.braun@gmx.de>
|
||||
|
||||
- version 3.4.3
|
||||
Patches removed (in version 3.4.3):
|
||||
inkscape11.patch
|
||||
0001-FIX-Pillow-asarray-bug.patch
|
||||
0002-Dont-modify-arrays-when-masking-values-for-log.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jul 27 12:09:25 UTC 2021 - Markéta Machová <mmachova@suse.com>
|
||||
|
||||
|
@ -31,7 +31,7 @@ ExclusiveArch: x86_64 aarch64
|
||||
%bcond_with test
|
||||
%endif
|
||||
Name: python-matplotlib%{psuffix}
|
||||
Version: 3.4.2
|
||||
Version: 3.4.3
|
||||
Release: 0
|
||||
Summary: Plotting Library for Python
|
||||
License: SUSE-Matplotlib
|
||||
@ -41,12 +41,7 @@ Source1: matplotlib-setup.cfg
|
||||
# Bundled version of freetype and qhull for testing purposes only
|
||||
Source98: http://www.qhull.org/download/qhull-2020-src-8.0.2.tgz
|
||||
Source99: https://downloads.sourceforge.net/project/freetype/freetype2/2.6.1/freetype-2.6.1.tar.gz
|
||||
# PATCH-FIX-UPSTREAM 0001-FIX-Pillow-asarray-bug.patch - Fix from upstream for an error related to asarray
|
||||
Patch0: 0001-FIX-Pillow-asarray-bug.patch
|
||||
# PATCH-FIX-UPSTREAM 0002-Dont-modify-arrays-when-masking-values-for-log.patch - Fix from upstream for numpy 1.21.0
|
||||
Patch1: 0002-Dont-modify-arrays-when-masking-values-for-log.patch
|
||||
# PATCH-FIX-UPSTREAM https://github.com/matplotlib/matplotlib/commit/73b7abf14c77014ab2436e7691e19cbee5864f4b Fix tests with Inkscape 1.1.
|
||||
Patch2: inkscape11.patch
|
||||
|
||||
BuildRequires: %{python_module Cycler >= 0.10}
|
||||
BuildRequires: %{python_module devel}
|
||||
BuildRequires: %{python_module kiwisolver >= 1.0.1}
|
||||
@ -251,9 +246,6 @@ for %{name} plotting package
|
||||
|
||||
%prep
|
||||
%setup -q -n matplotlib-%{version}
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
#copy freetype to the right location, so that matplotlib will not try to download it
|
||||
mkdir -p ~/.cache/matplotlib/
|
||||
SHA=($(sha256sum %{SOURCE98}))
|
||||
|
Loading…
Reference in New Issue
Block a user