Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 753d330

Browse files
authored
Merge pull request #11740 from anntzer/hatchless-backends
Deprecate support for 3rd-party backends without set_hatch_color.
2 parents e5d5d40 + 31a6682 commit 753d330

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Deprecations
2+
------------
3+
4+
Support for custom backends that do not provide a ``set_hatch_color`` method is
5+
deprecated. We suggest that custom backends let their ``GraphicsContext``
6+
class inherit from `GraphicsContextBase`, to at least provide stubs for all
7+
required methods.

lib/matplotlib/collections.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,10 @@ def draw(self, renderer):
271271
gc.set_hatch_color(self._hatch_color)
272272
except AttributeError:
273273
# if we end up with a GC that does not have this method
274-
warnings.warn("Your backend does not support setting the "
275-
"hatch color.")
274+
cbook.warn_deprecated(
275+
"3.1", "Your backend does not support setting the hatch "
276+
"color; such backends will become unsupported in "
277+
"Matplotlib 3.3.")
276278

277279
if self.get_sketch_params() is not None:
278280
gc.set_sketch_params(*self.get_sketch_params())

lib/matplotlib/patches.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,8 +517,10 @@ def draw(self, renderer):
517517
gc.set_hatch_color(self._hatch_color)
518518
except AttributeError:
519519
# if we end up with a GC that does not have this method
520-
warnings.warn(
521-
"Your backend does not support setting the hatch color.")
520+
cbook.warn_deprecated(
521+
"3.1", "Your backend does not support setting the hatch "
522+
"color; such backends will become unsupported in "
523+
"Matplotlib 3.3.")
522524

523525
if self.get_sketch_params() is not None:
524526
gc.set_sketch_params(*self.get_sketch_params())
@@ -4290,8 +4292,10 @@ def draw(self, renderer):
42904292
gc.set_hatch_color(self._hatch_color)
42914293
except AttributeError:
42924294
# if we end up with a GC that does not have this method
4293-
warnings.warn("Your backend does not support setting the "
4294-
"hatch color.")
4295+
cbook.warn_deprecated(
4296+
"3.1", "Your backend does not support setting the "
4297+
"hatch color; such backends will become unsupported "
4298+
"in Matplotlib 3.3.")
42954299

42964300
if self.get_sketch_params() is not None:
42974301
gc.set_sketch_params(*self.get_sketch_params())

0 commit comments

Comments
 (0)