Skip to content

Commit

Permalink
Added documentation of patch/alpha changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Westacular committed May 4, 2013
1 parent a7f7cc7 commit cd18645
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
15 changes: 15 additions & 0 deletions doc/api/api_changes.rst
Expand Up @@ -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
================

Expand Down
10 changes: 10 additions & 0 deletions doc/users/whats_new.rst
Expand Up @@ -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:

Expand Down
3 changes: 1 addition & 2 deletions lib/matplotlib/backend_bases.py
Expand Up @@ -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:
Expand Down

0 comments on commit cd18645

Please sign in to comment.