Skip to content

Commit a58b0d1

Browse files
committed
DOC: add whats_new and api_changes entries for gc hatch methods
1 parent f6b4a32 commit a58b0d1

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

doc/api/api_changes.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,30 @@ out what caused the breakage and how to fix it by updating your code.
1010
For new features that were added to Matplotlib, please see
1111
:ref:`whats-new`.
1212

13+
API Changes in 2.0.1
14+
====================
15+
16+
Extensions to `matplotlib.backend_bases.GraphicsContextBase`
17+
------------------------------------------------------------
18+
19+
To better support controlling the color of hatches, the method
20+
`matplotlib.backend_bases.GraphicsContextBase.set_hatch_color` was
21+
added to the expected API of ``GraphicsContext`` classes. Calls to
22+
this method are currently wrapped with a ``try:...except Attribute:``
23+
block to preserve back-compatibility with any third-party backends
24+
which do not extend `~matplotlib.backend_bases.GraphicsContextBase`.
25+
26+
This value can be accessed in the backends via
27+
`matplotlib.backend_bases.GraphicsContextBase.get_hatch_color` (which
28+
was added in 2.0 see :ref:`gc_get_hatch_color_wn`) and should be used
29+
to color the hatches.
30+
31+
In the future there may also be ``hatch_linewidth`` and
32+
``hatch_density`` related methods added. It is encouraged, but not
33+
required that third-party backends extend
34+
`~matplotlib.backend_bases.GraphicsContextBase` to make adapting to
35+
these changes easier.
36+
1337

1438
API Changes in 2.0.0
1539
====================

doc/users/whats_new.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,20 @@ value of ``None`` instead of ``2``. If ``None`` is given as ``zorder``,
313313
:func:`streamplot` has a default ``zorder`` of
314314
``matplotlib.lines.Line2D.zorder``.
315315

316+
.. _gc_get_hatch_color_wn:
317+
318+
Extension to `matplotlib.backend_bases.GraphicsContextBase`
319+
-----------------------------------------------------------
320+
321+
To support standardizing hatch behavior across the backends we ship
322+
the `matplotlib.backend_bases.GraphicsContextBase.get_hatch_color`
323+
method as added to `matplotlib.backend_bases.GraphicsContextBase`.
324+
This is only used during the render process in the backends we ship so
325+
will not break any third-party backends.
326+
327+
If you maintain a third-party backend which extends
328+
`~matplotlib.backend_bases.GraphicsContextBase` this method is now
329+
available to you and should be used to color hatch patterns.
316330

317331
Previous Whats New
318332
==================

0 commit comments

Comments
 (0)