From cd186451f846100d7c93520b3b28549e155256e1 Mon Sep 17 00:00:00 2001 From: Wes Campaigne Date: Sat, 4 May 2013 16:18:49 -0400 Subject: [PATCH] Added documentation of patch/alpha changes. --- doc/api/api_changes.rst | 15 +++++++++++++++ doc/users/whats_new.rst | 10 ++++++++++ lib/matplotlib/backend_bases.py | 3 +-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/doc/api/api_changes.rst b/doc/api/api_changes.rst index 0ed2dd87a796..49c463351524 100644 --- a/doc/api/api_changes.rst +++ b/doc/api/api_changes.rst @@ -43,6 +43,21 @@ Changes in 1.3.x * The :func:`~matplotlib.cbook.check_output` function has been moved to `~matplotlib.compat.subprocess`. +* :class:`~matplotlib.patches.Patch` now fully supports using RGBA values for + its ``facecolor`` and ``edgecolor`` attributes, which enables faces and + edges to have different alpha values. If the + :class:`~matplotlib.patches.Patch` object's ``alpha`` attribute is set to + anything other than ``None``, that value will override any alpha-channel + value in both the face and edge colors. Previously, if + :class:`~matplotlib.patches.Patch` had ``alpha=None``, the alpha component + of ``edgecolor`` would be applied to both the edge and face. + +* For :class:`~matplotlib.patches.Patch`, the ``capstyle`` used is now + ``butt``, to be consistent with the default for most other objects, and to + avoid problems with non-solid ``linestyle`` appearing solid when using a + large ``linewidth``. Previously, :class:`~matplotlib.patches.Patch` used + ``capstyle='projecting'``. + Changes in 1.2.x ================ diff --git a/doc/users/whats_new.rst b/doc/users/whats_new.rst index b87bc11ce098..bd9c096c508d 100644 --- a/doc/users/whats_new.rst +++ b/doc/users/whats_new.rst @@ -154,6 +154,16 @@ Wes Campaigne and Phil Elson fixed the Agg backend such that PNGs are now saved with the correct background color when :meth:`fig.patch.get_alpha` is not 1. +Independent alpha values for face and edge colors +------------------------------------------------- +Wes Campaigne modified how :class:`~matplotlib.patches.Patch` objects are +drawn such that (for backends supporting transparency) you can set different +alpha values for faces and edges, by specifying their colors in RGBA format. +Note that if you set the alpha attribute for the patch object (e.g. using +:meth:`~matplotlib.patches.Patch.set_alpha` or the ``alpha`` keyword +argument), that value will override the alpha components set in both the +face and edge colors. + .. _whats-new-1-2-2: diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index 256652265c06..a6273bdb20da 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -901,8 +901,7 @@ def set_foreground(self, fg, isRGBA=False): html hex color string, an rgb or rgba unit tuple, or a float between 0 and 1. In the latter case, grayscale is used. - If you know fg is rgb or rgba, set ``isRGBA=True`` for - efficiency. + If you know fg is rgba, set ``isRGBA=True`` for efficiency. """ self._orig_color = fg if self._forced_alpha: