Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Supporting different alphas for face and edge colours #1954

Merged
merged 8 commits into from

4 participants

@Westacular

This is a set of changes that solve the issues raised by #1899 and #1938.

Linestyles

Ignore what I said before in #1899 about linestyles.

Turns out it was working correctly for patches, but the dashes and dots were all overlapping at linewidth=5. The culprit is a single line in Patch.draw() that was setting the gc to use 'projecting' capstyle. This capstyle causes the rendered length of dashes and dots to increase in proportion to the width, however, the spacing between them (which ignores the caps) remains constant. At linewidth=5 the spaces are completely covered by the caps, making it look like linestyle='solid'.

Letting capstyle='butt', the default, fixes this.

(Also, there was a bug in the PGF backend that was causing Collections (or anything with a custom dash pattern) to always use a solid linestyle. Fixed that.)

Also, for some reason, in the SVG header stroke-linecap:square(the translation of capstyle='projecting') was being set as the default, even though the default for most objects is butt. This was causing a problem with the rendering of the PathCollection, because (at least on WebKit) the style for the collection, which did specify butt, was not overriding that default. The net effect was the same as the above problem for patches.

Mixed Edge and Face Alpha Values

There was already stubs of logic (and a _forced_alpha attribute of GraphicsContext) for the notion that if an explicit alpha is set (through gc.set_alpha()) it should override any face and edge alphas, but otherwise, leave them be; however, it was largely ignored by most backends, each of which tended to do its own slightly different thing with regard which it recognized and how it handled them.

I've updated (and tested to varying degrees) the AGG, PDF, SVG, PGF, Mac OS X, and Cairo backends, along with various fixes to the backend bases and to the Patch class. As far as I can tell, that covers everything that's already paying attention to the gc.get_alpha() value.

I also fixed the bug (also discussed at #1938) where setting an alpha value on the patch would override edgecolor='none'. The new behaviour is that the value given to alpha is ignored by the edge colour if and only if edgecolor='none' exactly; edgecolor=(x,x,x,0) still gets overridden by alpha. This is the existing behaviour for facecolor, which I've not changed.

I've included the test (and changes) added by @pelson in #1899, along with correct results, and corrected the results of the clip_to_bbox test (which were previously affected by the alpha=x/edgecolor='none' bug). I've also added another test to check that the alpha attribute is overriding the alpha components of the face and edge colors.

@pelson
Collaborator

The test results are looking good - there is a lot of change here which needs to be considered, but I'd like to target this for v1.3.

Amazing work @Westacular.

@Westacular

Thanks.

Just noticed the Travis build had failed. I didn't have inkscape installed, so I didn't notice there was a regression with SVG in my own testing. I've since fixed the problem (hatches were not having their alpha applied in SVGs).

@pelson
Collaborator

I didn't have inkscape installed, so I didn't notice there was a regression with SVG in my own testing. I've since fixed the problem (hatches were not having their alpha applied in SVGs).

Wooho! Travis caught a genuine problem! :smile:

@mdboom
Owner

@Westacular: Would you mind rebasing this on current master so that this will merge cleanly and the tests will run again?

pelson and others added some commits
@pelson pelson Failing tests. ae5c2f1
@Westacular Westacular Fixes bug where linestyle always appears solid if linewidth is large …
…enough
1e7399f
@Westacular Westacular Fixes bug where if alpha is set and edgecolor='none', edges would sti…
…ll be rendered as black.

Also fixes test case result that hit this bug
1aefc52
@Westacular Westacular Changes backends to support of independent face and edge alphas
Specifically, alters the base, AGG, PDF, PGF, SVG, Cairo, and Mac OS X
backends to better enable the use of RGBA color values for both fills
and edges. An explicit alpha attribute, if set, will override the
alpha channels of the color values.

Updates test results, which are now what would be expected.

Also fixes a couple bugs with handling of linestyles.
6cc8aaa
@Westacular Westacular Add additional patch tests. a7f7cc7
@Westacular

@Westacular: Would you mind rebasing this on current master so that this will merge cleanly and the tests will run again?

Done. (Also squashed some of the commits, where it made sense.)

@mdboom mdboom commented on the diff
lib/matplotlib/backends/backend_svg.py
@@ -289,7 +289,7 @@ def _write_default_style(self):
writer = self.writer
default_style = generate_css({
u'stroke-linejoin': u'round',
- u'stroke-linecap': u'square'})
+ u'stroke-linecap': u'butt'})
@mdboom Owner
mdboom added a note

Good catch -- indeed the "default" according to the SVG spec is butt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@mdboom
Owner

Thanks for all of this work. It looks great. I think it's significant enough that it should have an entry in what's new -- and perhaps in API changes, if there's a way of summarizing changes in behavior between old and new (even though old was obviously broken)...

@pelson
Collaborator

and perhaps in API changes

Definately.

@pelson pelson commented on the diff
lib/matplotlib/backend_bases.py
((20 lines not shown))
self._rgb = fg
else:
self._rgb = colors.colorConverter.to_rgba(fg)
- if len(self._rgb) == 4 and not self._forced_alpha:
- self.set_alpha(self._rgb[3])
@pelson Collaborator
pelson added a note

This is subtle, but I think it will break the non forced alpha case.

@pelson Collaborator
pelson added a note

Question: Should calling set_alpha turn on the forced_alpha value?

set_alpha does turn on _force_alpha -- in fact, it already did, I didn't need to change anything there. (But prior these changes, practically nothing actually paid attention to it.) Calling gc.set_alpha(None) clears _forced_alpha.

This doesn't break the non-forced alpha case because the backends themselves, where appropriate, now pull the alpha value straight out of _rgb[3] in the non forced alpha case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@pelson pelson commented on the diff
lib/matplotlib/backends/backend_cairo.py
((10 lines not shown))
ctx.set_source_rgba (fill_c[0], fill_c[1], fill_c[2], alpha)
else:
- ctx.set_source_rgba (fill_c[0], fill_c[1], fill_c[2], alpha*fill_c[3])
@pelson Collaborator
pelson added a note

Ouch. We don't have cairo tests to check this either (we need to think about testing the cairo backend more). Nice spot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@pelson pelson commented on the diff
lib/matplotlib/backends/backend_pdf.py
@@ -1443,11 +1443,21 @@ def check_gc(self, gc, fillcolor=None):
orig_fill = gc._fillcolor
gc._fillcolor = fillcolor
+ orig_alphas = gc._effective_alphas
+
+ if gc._forced_alpha:
+ gc._effective_alphas = (gc._alpha, gc._alpha)
+ elif fillcolor is None or len(fillcolor) < 4:
+ gc._effective_alphas = (gc._rgb[3], 1.0)
+ else:
+ gc._effective_alphas = (gc._rgb[3], fillcolor[3])
@pelson Collaborator
pelson added a note

Your effective alphas approach here is, IMHO, something that could be done in the GC object. The GC could then just draw an RGBA of fill and an RGBA of line color and the backend wouldn't need to know anything about _forced_alpha.

Do you know of a reason why that wouldn't be a viable approach?

@pelson Collaborator
pelson added a note

I guess what I'm suggesting is that we updated the necessary signatures (to draw_path for example) such that we pass through an RGBA rather than an RGB and expect the backend to figure out the final face RGBA color.

That actually is how draw_path is working, now, but I couldn't (or rather, didn't) guarantee that everything else worked that way.

The issue is there are instances where the GC is applying an alpha property to things that have neither fill or draw colours -- e.g., images -- which is done by setting an alpha on the backend's underlying context. (The Mac OS X backend comes to mind as an example.) Supporting that means:

  • The GC still needs to make use of its _alpha in some situations
  • We don't want this to stack on top of the RGBA specified in the colors
  • So we ought to guard against that.

I believe for draw_path itself, this isn't needed because the other changes I've made mean that gc.set_alpha isn't called for that -- the alphas (overridden or not) go directly in the edge and fill colours. But there are many other draw methods that I haven't vetted that could possibly call gc.set_alpha() and give it colours with alpha channel values and I was concerned about them clashing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Westacular

Thanks for all of this work. It looks great. I think it's significant enough that it should have an entry in what's new -- and perhaps in API changes, if there's a way of summarizing changes in behavior between old and new (even though old was obviously broken)...

Happy to help. I took a crack a explaining the high-level/user-facing changes, while omitting the finer details of other bugs that were fixed or how backends were changed. Let me know what you think.

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
@pelson Collaborator
pelson added a note

This is SVG only, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@pelson pelson commented on the diff
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.
@pelson Collaborator
pelson added a note

Nicely put. And sounds like sensible behaviour too. - that is a good sign :wink:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@pelson
Collaborator

I see this as the "open heart surgery" of v1.3 (@mdboom's terminology used for a PR of mine on transforms in v1.2). I think on the whole the behaviour is more consistent, expected and desirable as a result of this PR, and it is for that reason (and the thoroughness of @Westacular's work) that I'd be comfortable merging this.

:+1: - awesome work @Westacular!

@mdboom
Owner

Agreed! Awesome work!

I know this issue has been brought up by @efiring a number of times over the years, so I thought I'd give him the opportunity to comment before merging, just in case there's anything additional.

@efiring
Owner

I'm happy to see this.

There is one change in the formally public API that could be mentioned in API_CHANGES: in GraphicsContext*.set_foreground, the isRGB kwarg is now isRGBA. I think the change is fine, and it is unlikely that user code is calling this low-level method directly, so I don't think a deprecation process is needed.

@Westacular

Ok, I've added a note about the isRGBA change.

Thanks for the kind words... And thanks for trusting me with the scalpel. :)

@efiring efiring merged commit 60e67e0 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 3, 2013
  1. @pelson @Westacular

    Failing tests.

    pelson authored Westacular committed
  2. @Westacular
  3. @Westacular

    Fixes bug where if alpha is set and edgecolor='none', edges would sti…

    Westacular authored
    …ll be rendered as black.
    
    Also fixes test case result that hit this bug
  4. @Westacular

    Changes backends to support of independent face and edge alphas

    Westacular authored
    Specifically, alters the base, AGG, PDF, PGF, SVG, Cairo, and Mac OS X
    backends to better enable the use of RGBA color values for both fills
    and edges. An explicit alpha attribute, if set, will override the
    alpha channels of the color values.
    
    Updates test results, which are now what would be expected.
    
    Also fixes a couple bugs with handling of linestyles.
  5. @Westacular
Commits on May 4, 2013
  1. @Westacular
  2. @Westacular
Commits on May 8, 2013
  1. @Westacular
This page is out of date. Refresh to see the latest.
Showing with 1,265 additions and 140 deletions.
  1. +21 −0 doc/api/api_changes.rst
  2. +10 −0 doc/users/whats_new.rst
  3. +29 −23 lib/matplotlib/backend_bases.py
  4. +10 −7 lib/matplotlib/backends/backend_cairo.py
  5. +2 −2 lib/matplotlib/backends/backend_gdk.py
  6. +8 −6 lib/matplotlib/backends/backend_macosx.py
  7. +16 −4 lib/matplotlib/backends/backend_pdf.py
  8. +13 −10 lib/matplotlib/backends/backend_pgf.py
  9. +13 −4 lib/matplotlib/backends/backend_svg.py
  10. +2 −2 lib/matplotlib/backends/backend_wx.py
  11. +6 −11 lib/matplotlib/patches.py
  12. BIN  lib/matplotlib/tests/baseline_images/test_patches/clip_to_bbox.pdf
  13. BIN  lib/matplotlib/tests/baseline_images/test_patches/clip_to_bbox.png
  14. +48 −48 lib/matplotlib/tests/baseline_images/test_patches/clip_to_bbox.svg
  15. BIN  lib/matplotlib/tests/baseline_images/test_patches/patch_alpha_coloring.pdf
  16. BIN  lib/matplotlib/tests/baseline_images/test_patches/patch_alpha_coloring.png
  17. +311 −0 lib/matplotlib/tests/baseline_images/test_patches/patch_alpha_coloring.svg
  18. BIN  lib/matplotlib/tests/baseline_images/test_patches/patch_alpha_override.pdf
  19. BIN  lib/matplotlib/tests/baseline_images/test_patches/patch_alpha_override.png
  20. +311 −0 lib/matplotlib/tests/baseline_images/test_patches/patch_alpha_override.svg
  21. BIN  lib/matplotlib/tests/baseline_images/test_patches/patch_custom_linestyle.pdf
  22. BIN  lib/matplotlib/tests/baseline_images/test_patches/patch_custom_linestyle.png
  23. +311 −0 lib/matplotlib/tests/baseline_images/test_patches/patch_custom_linestyle.svg
  24. +107 −1 lib/matplotlib/tests/test_patches.py
  25. +14 −7 src/_backend_agg.cpp
  26. +2 −1  src/_backend_agg.h
  27. +31 −14 src/_macosx.m
View
21 doc/api/api_changes.rst
@@ -43,6 +43,27 @@ 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.
+
+* The optional ``isRGB`` argument to
+ :meth:`~matplotlib.backend_bases.GraphicsContextBase.set_foreground` (and
+ the other GraphicsContext classes that descend from it) has been renamed to
+ ``isRGBA``, and should now only be set to ``True`` if the ``fg`` color
+ argument is known to be an RGBA tuple.
+
+* 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
================
View
10 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.
@pelson Collaborator
pelson added a note

Nicely put. And sounds like sensible behaviour too. - that is a good sign :wink:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
.. _whats-new-1-2-2:
View
52 lib/matplotlib/backend_bases.py
@@ -362,8 +362,6 @@ def _iter_collection(self, gc, master_transform, all_transforms,
gc0 = self.new_gc()
gc0.copy_properties(gc)
- original_alpha = gc.get_alpha()
-
if Nfacecolors == 0:
rgbFace = None
@@ -387,7 +385,6 @@ def _iter_collection(self, gc, master_transform, all_transforms,
yo = -(yp - yo)
if not (np.isfinite(xo) and np.isfinite(yo)):
continue
- gc0.set_alpha(original_alpha)
if Nfacecolors:
rgbFace = facecolors[i % Nfacecolors]
if Nedgecolors:
@@ -400,16 +397,12 @@ def _iter_collection(self, gc, master_transform, all_transforms,
if fg[3] == 0.0:
gc0.set_linewidth(0)
else:
- gc0.set_alpha(gc0.get_alpha() * fg[3])
- gc0.set_foreground(fg[:3])
+ gc0.set_foreground(fg)
else:
gc0.set_foreground(fg)
if rgbFace is not None and len(rgbFace) == 4:
if rgbFace[3] == 0:
rgbFace = None
- else:
- gc0.set_alpha(gc0.get_alpha() * rgbFace[3])
- rgbFace = rgbFace[:3]
gc0.set_antialiased(antialiaseds[i % Naa])
if Nurls:
gc0.set_url(urls[i % Nurls])
@@ -562,7 +555,7 @@ def _draw_text_as_path(self, gc, x, y, s, prop, angle, ismath):
path, transform = self._get_text_path_transform(
x, y, s, prop, angle, ismath)
- color = gc.get_rgb()[:3]
+ color = gc.get_rgb()
gc.set_linewidth(0.0)
self.draw_path(gc, path, transform, rgbFace=color)
@@ -702,7 +695,8 @@ def __init__(self):
self._joinstyle = 'round'
self._linestyle = 'solid'
self._linewidth = 1
- self._rgb = (0.0, 0.0, 0.0)
+ self._rgb = (0.0, 0.0, 0.0, 1.0)
+ self._orig_color = (0.0, 0.0, 0.0, 1.0)
self._hatch = None
self._url = None
self._gid = None
@@ -711,6 +705,7 @@ def __init__(self):
def copy_properties(self, gc):
'Copy properties from gc to self'
self._alpha = gc._alpha
+ self._forced_alpha = gc._forced_alpha
self._antialiased = gc._antialiased
self._capstyle = gc._capstyle
self._cliprect = gc._cliprect
@@ -720,6 +715,7 @@ def copy_properties(self, gc):
self._linestyle = gc._linestyle
self._linewidth = gc._linewidth
self._rgb = gc._rgb
+ self._orig_color = gc._orig_color
self._hatch = gc._hatch
self._url = gc._url
self._gid = gc._gid
@@ -781,6 +777,13 @@ def get_dashes(self):
"""
return self._dashes
+ def get_forced_alpha(self):
+ """
+ Return whether the value given by get_alpha() should be used to
+ override any other alpha-channel values.
+ """
+ return self._forced_alpha
+
def get_joinstyle(self):
"""
Return the line join style as one of ('miter', 'round', 'bevel')
@@ -833,14 +836,19 @@ def get_snap(self):
def set_alpha(self, alpha):
"""
- Set the alpha value used for blending - not supported on
- all backends
+ Set the alpha value used for blending - not supported on all backends.
+ If ``alpha=None`` (the default), the alpha components of the
+ foreground and fill colors will be used to set their respective
+ transparencies (where applicable); otherwise, ``alpha`` will override
+ them.
"""
if alpha is not None:
self._alpha = alpha
self._forced_alpha = True
else:
+ self._alpha = 1.0
self._forced_alpha = False
+ self.set_foreground(self._orig_color)
def set_antialiased(self, b):
"""
@@ -890,30 +898,28 @@ def set_dashes(self, dash_offset, dash_list):
"""
self._dashes = dash_offset, dash_list
- def set_foreground(self, fg, isRGB=False):
+ def set_foreground(self, fg, isRGBA=False):
"""
Set the foreground color. fg can be a MATLAB format string, a
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 ``isRGB=True`` for
- efficiency.
+ If you know fg is rgba, set ``isRGBA=True`` for efficiency.
"""
- if isRGB:
+ self._orig_color = fg
+ if self._forced_alpha:
+ self._rgb = colors.colorConverter.to_rgba(fg, self._alpha)
+ elif isRGBA:
self._rgb = fg
else:
self._rgb = colors.colorConverter.to_rgba(fg)
- if len(self._rgb) == 4 and not self._forced_alpha:
- self.set_alpha(self._rgb[3])
@pelson Collaborator
pelson added a note

This is subtle, but I think it will break the non forced alpha case.

@pelson Collaborator
pelson added a note

Question: Should calling set_alpha turn on the forced_alpha value?

set_alpha does turn on _force_alpha -- in fact, it already did, I didn't need to change anything there. (But prior these changes, practically nothing actually paid attention to it.) Calling gc.set_alpha(None) clears _forced_alpha.

This doesn't break the non-forced alpha case because the backends themselves, where appropriate, now pull the alpha value straight out of _rgb[3] in the non forced alpha case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
- # Use set_alpha method here so that subclasses will
- # be calling their own version, which may set their
- # own attributes.
def set_graylevel(self, frac):
"""
Set the foreground color to be a gray level with *frac*
"""
- self._rgb = (frac, frac, frac)
+ self._orig_color = frac
+ self._rgb = (frac, frac, frac, self._alpha)
def set_joinstyle(self, js):
"""
@@ -942,7 +948,7 @@ def set_linestyle(self, style):
'dotted' : (0, (1.0, 3.0)),
"""
- if style in self.dashd.keys():
+ if style in self.dashd:
offset, dashes = self.dashd[style]
elif isinstance(style, tuple):
offset, dashes = style
View
17 lib/matplotlib/backends/backend_cairo.py
@@ -110,13 +110,13 @@ def set_width_height(self, width, height):
# font transform?
- def _fill_and_stroke (self, ctx, fill_c, alpha):
+ def _fill_and_stroke (self, ctx, fill_c, alpha, alpha_overrides):
if fill_c is not None:
ctx.save()
- if len(fill_c) == 3:
+ if len(fill_c) == 3 or alpha_overrides:
ctx.set_source_rgba (fill_c[0], fill_c[1], fill_c[2], alpha)
else:
- ctx.set_source_rgba (fill_c[0], fill_c[1], fill_c[2], alpha*fill_c[3])
@pelson Collaborator
pelson added a note

Ouch. We don't have cairo tests to check this either (we need to think about testing the cairo backend more). Nice spot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ ctx.set_source_rgba (fill_c[0], fill_c[1], fill_c[2], fill_c[3])
ctx.fill_preserve()
ctx.restore()
ctx.stroke()
@@ -150,7 +150,7 @@ def draw_path(self, gc, path, transform, rgbFace=None):
ctx.new_path()
self.convert_path(ctx, path, transform)
- self._fill_and_stroke(ctx, rgbFace, gc.get_alpha())
+ self._fill_and_stroke(ctx, rgbFace, gc.get_alpha(), gc.get_forced_alpha())
def draw_image(self, gc, x, y, im):
# bbox - not currently used
@@ -316,7 +316,10 @@ def set_alpha(self, alpha):
GraphicsContextBase.set_alpha(self, alpha)
_alpha = self.get_alpha()
rgb = self._rgb
- self.ctx.set_source_rgba (rgb[0], rgb[1], rgb[2], _alpha)
+ if self.get_forced_alpha():
+ self.ctx.set_source_rgba (rgb[0], rgb[1], rgb[2], _alpha)
+ else:
+ self.ctx.set_source_rgba (rgb[0], rgb[1], rgb[2], rgb[3])
#def set_antialiased(self, b):
@@ -359,8 +362,8 @@ def set_dashes(self, offset, dashes):
self.renderer.points_to_pixels (np.asarray(dashes)), offset)
- def set_foreground(self, fg, isRGB=None):
- GraphicsContextBase.set_foreground(self, fg, isRGB)
+ def set_foreground(self, fg, isRGBA=None):
+ GraphicsContextBase.set_foreground(self, fg, isRGBA)
if len(self._rgb) == 3:
self.ctx.set_source_rgb(*self._rgb)
else:
View
4 lib/matplotlib/backends/backend_gdk.py
@@ -393,8 +393,8 @@ def set_dashes(self, dash_offset, dash_list):
self.gdkGC.line_style = gdk.LINE_ON_OFF_DASH
- def set_foreground(self, fg, isRGB=False):
- GraphicsContextBase.set_foreground(self, fg, isRGB)
+ def set_foreground(self, fg, isRGBA=False):
+ GraphicsContextBase.set_foreground(self, fg, isRGBA)
self.gdkGC.foreground = self.rgb_to_gdk_color(self.get_rgb())
View
14 lib/matplotlib/backends/backend_macosx.py
@@ -50,13 +50,13 @@ def set_width_height (self, width, height):
def draw_path(self, gc, path, transform, rgbFace=None):
if rgbFace is not None:
- rgbFace = tuple(rgbFace[:3])
+ rgbFace = tuple(rgbFace)
linewidth = gc.get_linewidth()
gc.draw_path(path, transform, linewidth, rgbFace)
def draw_markers(self, gc, marker_path, marker_trans, path, trans, rgbFace=None):
if rgbFace is not None:
- rgbFace = tuple(rgbFace[:3])
+ rgbFace = tuple(rgbFace)
linewidth = gc.get_linewidth()
gc.draw_markers(marker_path, marker_trans, path, trans, linewidth, rgbFace)
@@ -183,12 +183,14 @@ def __init__(self):
def set_alpha(self, alpha):
GraphicsContextBase.set_alpha(self, alpha)
_alpha = self.get_alpha()
- _macosx.GraphicsContext.set_alpha(self, _alpha)
+ _macosx.GraphicsContext.set_alpha(self, _alpha, self.get_forced_alpha())
+ rgb = self.get_rgb()
+ _macosx.GraphicsContext.set_foreground(self, rgb)
- def set_foreground(self, fg, isRGB=False):
- GraphicsContextBase.set_foreground(self, fg, isRGB)
+ def set_foreground(self, fg, isRGBA=False):
+ GraphicsContextBase.set_foreground(self, fg, isRGBA)
rgb = self.get_rgb()
- _macosx.GraphicsContext.set_foreground(self, rgb[:3])
+ _macosx.GraphicsContext.set_foreground(self, rgb)
def set_graylevel(self, fg):
GraphicsContextBase.set_graylevel(self, fg)
View
20 lib/matplotlib/backends/backend_pdf.py
@@ -1064,7 +1064,7 @@ def alphaState(self, alpha):
self.nextAlphaState += 1
self.alphaStates[alpha] = \
(name, { 'Type': Name('ExtGState'),
- 'CA': alpha, 'ca': alpha })
+ 'CA': alpha[0], 'ca': alpha[1] })
return name
def hatchPattern(self, hatch_style):
@@ -1443,11 +1443,21 @@ def check_gc(self, gc, fillcolor=None):
orig_fill = gc._fillcolor
gc._fillcolor = fillcolor
+ orig_alphas = gc._effective_alphas
+
+ if gc._forced_alpha:
+ gc._effective_alphas = (gc._alpha, gc._alpha)
+ elif fillcolor is None or len(fillcolor) < 4:
+ gc._effective_alphas = (gc._rgb[3], 1.0)
+ else:
+ gc._effective_alphas = (gc._rgb[3], fillcolor[3])
@pelson Collaborator
pelson added a note

Your effective alphas approach here is, IMHO, something that could be done in the GC object. The GC could then just draw an RGBA of fill and an RGBA of line color and the backend wouldn't need to know anything about _forced_alpha.

Do you know of a reason why that wouldn't be a viable approach?

@pelson Collaborator
pelson added a note

I guess what I'm suggesting is that we updated the necessary signatures (to draw_path for example) such that we pass through an RGBA rather than an RGB and expect the backend to figure out the final face RGBA color.

That actually is how draw_path is working, now, but I couldn't (or rather, didn't) guarantee that everything else worked that way.

The issue is there are instances where the GC is applying an alpha property to things that have neither fill or draw colours -- e.g., images -- which is done by setting an alpha on the backend's underlying context. (The Mac OS X backend comes to mind as an example.) Supporting that means:

  • The GC still needs to make use of its _alpha in some situations
  • We don't want this to stack on top of the RGBA specified in the colors
  • So we ought to guard against that.

I believe for draw_path itself, this isn't needed because the other changes I've made mean that gc.set_alpha isn't called for that -- the alphas (overridden or not) go directly in the edge and fill colours. But there are many other draw methods that I haven't vetted that could possibly call gc.set_alpha() and give it colours with alpha channel values and I was concerned about them clashing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
delta = self.gc.delta(gc)
if delta: self.file.output(*delta)
# Restore gc to avoid unwanted side effects
gc._fillcolor = orig_fill
+ gc._effective_alphas = orig_alphas
def tex_font_mapping(self, texfont):
if self.tex_font_map is None:
@@ -2004,6 +2014,7 @@ class GraphicsContextPdf(GraphicsContextBase):
def __init__(self, file):
GraphicsContextBase.__init__(self)
self._fillcolor = (0.0, 0.0, 0.0)
+ self._effective_alphas = (1.0, 1.0)
self.file = file
self.parent = None
@@ -2072,8 +2083,8 @@ def dash_cmd(self, dashes):
offset = 0
return [list(dash), offset, Op.setdash]
- def alpha_cmd(self, alpha):
- name = self.file.alphaState(alpha)
+ def alpha_cmd(self, alpha, forced, effective_alphas):
+ name = self.file.alphaState(effective_alphas)
return [name, Op.setgstate]
def hatch_cmd(self, hatch):
@@ -2138,7 +2149,7 @@ def clip_cmd(self, cliprect, clippath):
commands = (
(('_cliprect', '_clippath'), clip_cmd), # must come first since may pop
- (('_alpha',), alpha_cmd),
+ (('_alpha', '_forced_alpha', '_effective_alphas'), alpha_cmd),
(('_capstyle',), capstyle_cmd),
(('_fillcolor',), fillcolor_cmd),
(('_joinstyle',), joinstyle_cmd),
@@ -2183,6 +2194,7 @@ def copy_properties(self, other):
"""
GraphicsContextBase.copy_properties(self, other)
self._fillcolor = other._fillcolor
+ self._effective_alphas = other._effective_alphas
def finalize(self):
"""
View
23 lib/matplotlib/backends/backend_pgf.py
@@ -513,14 +513,18 @@ def _print_pgf_path_styles(self, gc, rgbFace):
# filling
has_fill = rgbFace is not None
- path_is_transparent = gc.get_alpha() != 1.0
- fill_is_transparent = has_fill and (len(rgbFace) > 3) and (rgbFace[3] != 1.0)
+
+ if gc.get_forced_alpha():
+ fillopacity = strokeopacity = gc.get_alpha()
+ else:
+ strokeopacity = gc.get_rgb()[3]
+ fillopacity = rgbFace[3] if has_fill and len(rgbFace) > 3 else 1.0
+
if has_fill:
writeln(self.fh, r"\definecolor{currentfill}{rgb}{%f,%f,%f}" % tuple(rgbFace[:3]))
writeln(self.fh, r"\pgfsetfillcolor{currentfill}")
- if has_fill and (path_is_transparent or fill_is_transparent):
- opacity = gc.get_alpha() * 1.0 if not fill_is_transparent else rgbFace[3]
- writeln(self.fh, r"\pgfsetfillopacity{%f}" % opacity)
+ if has_fill and fillopacity != 1.0:
+ writeln(self.fh, r"\pgfsetfillopacity{%f}" % fillopacity)
# linewidth and color
lw = gc.get_linewidth() * mpl_pt_to_in * latex_in_to_pt
@@ -528,15 +532,14 @@ def _print_pgf_path_styles(self, gc, rgbFace):
writeln(self.fh, r"\pgfsetlinewidth{%fpt}" % lw)
writeln(self.fh, r"\definecolor{currentstroke}{rgb}{%f,%f,%f}" % stroke_rgba[:3])
writeln(self.fh, r"\pgfsetstrokecolor{currentstroke}")
- if gc.get_alpha() != 1.0:
- writeln(self.fh, r"\pgfsetstrokeopacity{%f}" % gc.get_alpha())
+ if strokeopacity != 1.0:
+ writeln(self.fh, r"\pgfsetstrokeopacity{%f}" % strokeopacity)
# line style
dash_offset, dash_list = gc.get_dashes()
- ls = gc.get_linestyle(None)
- if ls == "solid":
+ if dash_list is None:
writeln(self.fh, r"\pgfsetdash{}{0pt}")
- elif (ls == "dashed" or ls == "dashdot" or ls == "dotted"):
+ else:
dash_str = r"\pgfsetdash{"
for dash in dash_list:
dash_str += r"{%fpt}" % dash
View
17 lib/matplotlib/backends/backend_svg.py
@@ -289,7 +289,7 @@ def _write_default_style(self):
writer = self.writer
default_style = generate_css({
u'stroke-linejoin': u'round',
- u'stroke-linecap': u'square'})
+ u'stroke-linecap': u'butt'})
@mdboom Owner
mdboom added a note

Good catch -- indeed the "default" according to the SVG spec is butt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
writer.start(u'defs')
writer.start(u'style', type=u'text/css')
writer.data(u'*{%s}\n' % default_style)
@@ -386,15 +386,21 @@ def _get_style_dict(self, gc, rgbFace):
"""
attrib = {}
+ forced_alpha = gc.get_forced_alpha()
+
if gc.get_hatch() is not None:
attrib[u'fill'] = u"url(#%s)" % self._get_hatch(gc, rgbFace)
+ if rgbFace is not None and len(rgbFace) == 4 and rgbFace[3] != 1.0 and not forced_alpha:
+ attrib[u'fill-opacity'] = str(rgbFace[3])
else:
if rgbFace is None:
attrib[u'fill'] = u'none'
elif tuple(rgbFace[:3]) != (0, 0, 0):
attrib[u'fill'] = rgb2hex(rgbFace)
+ if len(rgbFace) == 4 and rgbFace[3] != 1.0 and not forced_alpha:
+ attrib[u'fill-opacity'] = str(rgbFace[3])
- if gc.get_alpha() != 1.0:
+ if forced_alpha and gc.get_alpha() != 1.0:
attrib[u'opacity'] = str(gc.get_alpha())
offset, seq = gc.get_dashes()
@@ -404,12 +410,15 @@ def _get_style_dict(self, gc, rgbFace):
linewidth = gc.get_linewidth()
if linewidth:
- attrib[u'stroke'] = rgb2hex(gc.get_rgb())
+ rgb = gc.get_rgb()
+ attrib[u'stroke'] = rgb2hex(rgb)
+ if not forced_alpha and rgb[3] != 1.0:
+ attrib[u'stroke-opacity'] = str(rgb[3])
if linewidth != 1.0:
attrib[u'stroke-width'] = str(linewidth)
if gc.get_joinstyle() != 'round':
attrib[u'stroke-linejoin'] = gc.get_joinstyle()
- if gc.get_capstyle() != 'projecting':
+ if gc.get_capstyle() != 'butt':
attrib[u'stroke-linecap'] = _capstyle_d[gc.get_capstyle()]
return attrib
View
4 lib/matplotlib/backends/backend_wx.py
@@ -517,7 +517,7 @@ def unselect(self):
self.dc.SelectObject(wx.NullBitmap)
self.IsSelected = False
- def set_foreground(self, fg, isRGB=None):
+ def set_foreground(self, fg, isRGBA=None):
"""
Set the foreground color. fg can be a matlab format string, a
html hex color string, an rgb unit tuple, or a float between 0
@@ -530,7 +530,7 @@ def set_foreground(self, fg, isRGB=None):
# Same goes for text foreground...
DEBUG_MSG("set_foreground()", 1, self)
self.select()
- GraphicsContextBase.set_foreground(self, fg, isRGB)
+ GraphicsContextBase.set_foreground(self, fg, isRGBA)
self._pen.SetColour(self.get_wxcolour(self.get_rgb()))
self.gfx_ctx.SetPen(self._pen)
View
17 lib/matplotlib/patches.py
@@ -251,6 +251,7 @@ def set_edgecolor(self, color):
"""
if color is None:
color = mpl.rcParams['patch.edgecolor']
+ self._original_edgecolor = color
self._edgecolor = colors.colorConverter.to_rgba(color, self._alpha)
def set_ec(self, color):
@@ -304,8 +305,7 @@ def set_alpha(self, alpha):
artist.Artist.set_alpha(self, alpha)
self.set_facecolor(self._original_facecolor) # using self._fill and
# self._alpha
- self._edgecolor = colors.colorConverter.to_rgba(
- self._edgecolor[:3], self._alpha)
+ self.set_edgecolor(self._original_edgecolor)
def set_linewidth(self, w):
"""
@@ -404,7 +404,7 @@ def draw(self, renderer):
renderer.open_group('patch', self.get_gid())
gc = renderer.new_gc()
- gc.set_foreground(self._edgecolor, isRGB=True)
+ gc.set_foreground(self._edgecolor, isRGBA=True)
lw = self._linewidth
if self._edgecolor[3] == 0:
@@ -414,7 +414,6 @@ def draw(self, renderer):
gc.set_antialiased(self._antialiased)
self._set_gc_clip(gc)
- gc.set_capstyle('projecting')
gc.set_url(self._url)
gc.set_snap(self.get_snap())
@@ -422,9 +421,7 @@ def draw(self, renderer):
if rgbFace[3] == 0:
rgbFace = None # (some?) renderers expect this as no-fill signal
- gc.set_alpha(self._edgecolor[3])
- if self._edgecolor[3] == 0:
- gc.set_alpha(self._facecolor[3])
+ gc.set_alpha(self._alpha)
if self._hatch:
gc.set_hatch(self._hatch)
@@ -3995,7 +3992,7 @@ def draw(self, renderer):
renderer.open_group('patch', self.get_gid())
gc = renderer.new_gc()
- gc.set_foreground(self._edgecolor, isRGB=True)
+ gc.set_foreground(self._edgecolor, isRGBA=True)
lw = self._linewidth
if self._edgecolor[3] == 0:
@@ -4012,9 +4009,7 @@ def draw(self, renderer):
if rgbFace[3] == 0:
rgbFace = None # (some?) renderers expect this as no-fill signal
- gc.set_alpha(self._edgecolor[3])
- if self._edgecolor[3] == 0:
- gc.set_alpha(self._facecolor[3])
+ gc.set_alpha(self._alpha)
if self._hatch:
gc.set_hatch(self._hatch)
View
BIN  lib/matplotlib/tests/baseline_images/test_patches/clip_to_bbox.pdf
Binary file not shown
View
BIN  lib/matplotlib/tests/baseline_images/test_patches/clip_to_bbox.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
96 lib/matplotlib/tests/baseline_images/test_patches/clip_to_bbox.svg
@@ -5,7 +5,7 @@
<svg height="432pt" version="1.1" viewBox="0 0 576 432" width="576pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<style type="text/css">
-*{stroke-linecap:square;stroke-linejoin:round;}
+*{stroke-linecap:butt;stroke-linejoin:round;}
</style>
</defs>
<g id="figure_1">
@@ -58,7 +58,7 @@ C295.83 144.173 283.453 179.338 283.453 216
C283.453 252.662 295.83 287.827 317.86 313.75
C339.889 339.674 369.772 354.24 400.926 354.24
z
-" style="fill:#ff7f50;opacity:0.5;stroke:#000000;"/>
+" style="fill:#ff7f50;opacity:0.5;"/>
</g>
<g id="patch_4">
<path clip-path="url(#p7ff5b81e1d)" d="
@@ -92,20 +92,20 @@ L462.249 333.504" style="fill:#008000;opacity:0.5;stroke:#000000;stroke-width:4;
<defs>
<path d="
M0 0
-L0 -4" id="mcb557df647" style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;"/>
+L0 -4" id="m93b0483c22" style="stroke:#000000;stroke-width:0.5;"/>
</defs>
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="107.242105263" xlink:href="#mcb557df647" y="388.8"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="107.242105263" xlink:href="#m93b0483c22" y="388.8"/>
</g>
</g>
<g id="line2d_2">
<defs>
<path d="
M0 0
-L0 4" id="mdad270ee8e" style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;"/>
+L0 4" id="m741efc42ff" style="stroke:#000000;stroke-width:0.5;"/>
</defs>
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="107.242105263" xlink:href="#mdad270ee8e" y="43.2"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="107.242105263" xlink:href="#m741efc42ff" y="43.2"/>
</g>
</g>
<g id="text_1">
@@ -158,7 +158,7 @@ Q14.8906 38.1406 10.7969 36.2812
z
" id="BitstreamVeraSans-Roman-35"/>
</defs>
- <g transform="translate(95.7389802632 401.54875)scale(0.12 -0.12)">
+ <g transform="translate(95.7389802632 401.918125)scale(0.12 -0.12)">
<use xlink:href="#BitstreamVeraSans-Roman-2212"/>
<use x="83.7890625" xlink:href="#BitstreamVeraSans-Roman-31"/>
<use x="147.412109375" xlink:href="#BitstreamVeraSans-Roman-35"/>
@@ -168,12 +168,12 @@ z
<g id="xtick_2">
<g id="line2d_3">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="165.978947368" xlink:href="#mcb557df647" y="388.8"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="165.978947368" xlink:href="#m93b0483c22" y="388.8"/>
</g>
</g>
<g id="line2d_4">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="165.978947368" xlink:href="#mdad270ee8e" y="43.2"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="165.978947368" xlink:href="#m741efc42ff" y="43.2"/>
</g>
</g>
<g id="text_2">
@@ -199,7 +199,7 @@ Q6.59375 17.9688 6.59375 36.375
Q6.59375 54.8281 13.0625 64.5156
Q19.5312 74.2188 31.7812 74.2188" id="BitstreamVeraSans-Roman-30"/>
</defs>
- <g transform="translate(154.350197368 401.70625)scale(0.12 -0.12)">
+ <g transform="translate(154.350197368 401.918125)scale(0.12 -0.12)">
<use xlink:href="#BitstreamVeraSans-Roman-2212"/>
<use x="83.7890625" xlink:href="#BitstreamVeraSans-Roman-31"/>
<use x="147.412109375" xlink:href="#BitstreamVeraSans-Roman-30"/>
@@ -209,17 +209,17 @@ Q19.5312 74.2188 31.7812 74.2188" id="BitstreamVeraSans-Roman-30"/>
<g id="xtick_3">
<g id="line2d_5">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="224.715789474" xlink:href="#mcb557df647" y="388.8"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="224.715789474" xlink:href="#m93b0483c22" y="388.8"/>
</g>
</g>
<g id="line2d_6">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="224.715789474" xlink:href="#mdad270ee8e" y="43.2"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="224.715789474" xlink:href="#m741efc42ff" y="43.2"/>
</g>
</g>
<g id="text_3">
<!-- −5 -->
- <g transform="translate(217.030164474 401.54875)scale(0.12 -0.12)">
+ <g transform="translate(217.030164474 401.918125)scale(0.12 -0.12)">
<use xlink:href="#BitstreamVeraSans-Roman-2212"/>
<use x="83.7890625" xlink:href="#BitstreamVeraSans-Roman-35"/>
</g>
@@ -228,17 +228,17 @@ Q19.5312 74.2188 31.7812 74.2188" id="BitstreamVeraSans-Roman-30"/>
<g id="xtick_4">
<g id="line2d_7">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="283.452631579" xlink:href="#mcb557df647" y="388.8"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="283.452631579" xlink:href="#m93b0483c22" y="388.8"/>
</g>
</g>
<g id="line2d_8">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="283.452631579" xlink:href="#mdad270ee8e" y="43.2"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="283.452631579" xlink:href="#m741efc42ff" y="43.2"/>
</g>
</g>
<g id="text_4">
<!-- 0 -->
- <g transform="translate(280.429194079 401.70625)scale(0.12 -0.12)">
+ <g transform="translate(280.429194079 401.918125)scale(0.12 -0.12)">
<use xlink:href="#BitstreamVeraSans-Roman-30"/>
</g>
</g>
@@ -246,17 +246,17 @@ Q19.5312 74.2188 31.7812 74.2188" id="BitstreamVeraSans-Roman-30"/>
<g id="xtick_5">
<g id="line2d_9">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="342.189473684" xlink:href="#mcb557df647" y="388.8"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="342.189473684" xlink:href="#m93b0483c22" y="388.8"/>
</g>
</g>
<g id="line2d_10">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="342.189473684" xlink:href="#mdad270ee8e" y="43.2"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="342.189473684" xlink:href="#m741efc42ff" y="43.2"/>
</g>
</g>
<g id="text_5">
<!-- 5 -->
- <g transform="translate(339.359161184 401.54875)scale(0.12 -0.12)">
+ <g transform="translate(339.359161184 401.918125)scale(0.12 -0.12)">
<use xlink:href="#BitstreamVeraSans-Roman-35"/>
</g>
</g>
@@ -264,17 +264,17 @@ Q19.5312 74.2188 31.7812 74.2188" id="BitstreamVeraSans-Roman-30"/>
<g id="xtick_6">
<g id="line2d_11">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="400.926315789" xlink:href="#mcb557df647" y="388.8"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="400.926315789" xlink:href="#m93b0483c22" y="388.8"/>
</g>
</g>
<g id="line2d_12">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="400.926315789" xlink:href="#mdad270ee8e" y="43.2"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="400.926315789" xlink:href="#m741efc42ff" y="43.2"/>
</g>
</g>
<g id="text_6">
<!-- 10 -->
- <g transform="translate(394.348815789 401.70625)scale(0.12 -0.12)">
+ <g transform="translate(394.348815789 401.918125)scale(0.12 -0.12)">
<use xlink:href="#BitstreamVeraSans-Roman-31"/>
<use x="63.623046875" xlink:href="#BitstreamVeraSans-Roman-30"/>
</g>
@@ -283,17 +283,17 @@ Q19.5312 74.2188 31.7812 74.2188" id="BitstreamVeraSans-Roman-30"/>
<g id="xtick_7">
<g id="line2d_13">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="459.663157895" xlink:href="#mcb557df647" y="388.8"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="459.663157895" xlink:href="#m93b0483c22" y="388.8"/>
</g>
</g>
<g id="line2d_14">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="459.663157895" xlink:href="#mdad270ee8e" y="43.2"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="459.663157895" xlink:href="#m741efc42ff" y="43.2"/>
</g>
</g>
<g id="text_7">
<!-- 15 -->
- <g transform="translate(453.211282895 401.54875)scale(0.12 -0.12)">
+ <g transform="translate(453.211282895 401.918125)scale(0.12 -0.12)">
<use xlink:href="#BitstreamVeraSans-Roman-31"/>
<use x="63.623046875" xlink:href="#BitstreamVeraSans-Roman-35"/>
</g>
@@ -302,12 +302,12 @@ Q19.5312 74.2188 31.7812 74.2188" id="BitstreamVeraSans-Roman-30"/>
<g id="xtick_8">
<g id="line2d_15">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#mcb557df647" y="388.8"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#m93b0483c22" y="388.8"/>
</g>
</g>
<g id="line2d_16">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#mdad270ee8e" y="43.2"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#m741efc42ff" y="43.2"/>
</g>
</g>
<g id="text_8">
@@ -337,7 +337,7 @@ Q49.8594 40.875 45.4062 35.4062
Q44.1875 33.9844 37.6406 27.2188
Q31.1094 20.4531 19.1875 8.29688" id="BitstreamVeraSans-Roman-32"/>
</defs>
- <g transform="translate(511.603125 401.70625)scale(0.12 -0.12)">
+ <g transform="translate(511.603125 401.918125)scale(0.12 -0.12)">
<use xlink:href="#BitstreamVeraSans-Roman-32"/>
<use x="63.623046875" xlink:href="#BitstreamVeraSans-Roman-30"/>
</g>
@@ -350,25 +350,25 @@ Q31.1094 20.4531 19.1875 8.29688" id="BitstreamVeraSans-Roman-32"/>
<defs>
<path d="
M0 0
-L4 0" id="mc8fcea1516" style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;"/>
+L4 0" id="m728421d6d4" style="stroke:#000000;stroke-width:0.5;"/>
</defs>
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mc8fcea1516" y="388.8"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m728421d6d4" y="388.8"/>
</g>
</g>
<g id="line2d_18">
<defs>
<path d="
M0 0
-L-4 0" id="m0d5b0a6425" style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;"/>
+L-4 0" id="mcb0005524f" style="stroke:#000000;stroke-width:0.5;"/>
</defs>
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#m0d5b0a6425" y="388.8"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#mcb0005524f" y="388.8"/>
</g>
</g>
<g id="text_9">
<!-- −150 -->
- <g transform="translate(37.1075 393.1678125)scale(0.12 -0.12)">
+ <g transform="translate(37.1075 392.11125)scale(0.12 -0.12)">
<use xlink:href="#BitstreamVeraSans-Roman-2212"/>
<use x="83.7890625" xlink:href="#BitstreamVeraSans-Roman-31"/>
<use x="147.412109375" xlink:href="#BitstreamVeraSans-Roman-35"/>
@@ -379,17 +379,17 @@ L-4 0" id="m0d5b0a6425" style="stroke:#000000;stroke-linecap:butt;stroke-width:0
<g id="ytick_2">
<g id="line2d_19">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mc8fcea1516" y="319.68"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m728421d6d4" y="319.68"/>
</g>
</g>
<g id="line2d_20">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#m0d5b0a6425" y="319.68"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#mcb0005524f" y="319.68"/>
</g>
</g>
<g id="text_10">
<!-- −100 -->
- <g transform="translate(37.1075 324.0478125)scale(0.12 -0.12)">
+ <g transform="translate(37.1075 322.99125)scale(0.12 -0.12)">
<use xlink:href="#BitstreamVeraSans-Roman-2212"/>
<use x="83.7890625" xlink:href="#BitstreamVeraSans-Roman-31"/>
<use x="147.412109375" xlink:href="#BitstreamVeraSans-Roman-30"/>
@@ -400,17 +400,17 @@ L-4 0" id="m0d5b0a6425" style="stroke:#000000;stroke-linecap:butt;stroke-width:0
<g id="ytick_3">
<g id="line2d_21">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mc8fcea1516" y="250.56"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m728421d6d4" y="250.56"/>
</g>
</g>
<g id="line2d_22">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#m0d5b0a6425" y="250.56"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#mcb0005524f" y="250.56"/>
</g>
</g>
<g id="text_11">
<!-- −50 -->
- <g transform="translate(44.7425 254.9278125)scale(0.12 -0.12)">
+ <g transform="translate(44.7425 253.87125)scale(0.12 -0.12)">
<use xlink:href="#BitstreamVeraSans-Roman-2212"/>
<use x="83.7890625" xlink:href="#BitstreamVeraSans-Roman-35"/>
<use x="147.412109375" xlink:href="#BitstreamVeraSans-Roman-30"/>
@@ -420,17 +420,17 @@ L-4 0" id="m0d5b0a6425" style="stroke:#000000;stroke-linecap:butt;stroke-width:0
<g id="ytick_4">
<g id="line2d_23">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mc8fcea1516" y="181.44"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m728421d6d4" y="181.44"/>
</g>
</g>
<g id="line2d_24">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#m0d5b0a6425" y="181.44"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#mcb0005524f" y="181.44"/>
</g>
</g>
<g id="text_12">
<!-- 0 -->
- <g transform="translate(61.953125 185.8078125)scale(0.12 -0.12)">
+ <g transform="translate(61.953125 184.75125)scale(0.12 -0.12)">
<use xlink:href="#BitstreamVeraSans-Roman-30"/>
</g>
</g>
@@ -438,17 +438,17 @@ L-4 0" id="m0d5b0a6425" style="stroke:#000000;stroke-linecap:butt;stroke-width:0
<g id="ytick_5">
<g id="line2d_25">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mc8fcea1516" y="112.32"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m728421d6d4" y="112.32"/>
</g>
</g>
<g id="line2d_26">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#m0d5b0a6425" y="112.32"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#mcb0005524f" y="112.32"/>
</g>
</g>
<g id="text_13">
<!-- 50 -->
- <g transform="translate(54.453125 116.6878125)scale(0.12 -0.12)">
+ <g transform="translate(54.453125 115.63125)scale(0.12 -0.12)">
<use xlink:href="#BitstreamVeraSans-Roman-35"/>
<use x="63.623046875" xlink:href="#BitstreamVeraSans-Roman-30"/>
</g>
@@ -457,17 +457,17 @@ L-4 0" id="m0d5b0a6425" style="stroke:#000000;stroke-linecap:butt;stroke-width:0
<g id="ytick_6">
<g id="line2d_27">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mc8fcea1516" y="43.2"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m728421d6d4" y="43.2"/>
</g>
</g>
<g id="line2d_28">
<g>
- <use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#m0d5b0a6425" y="43.2"/>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#mcb0005524f" y="43.2"/>
</g>
</g>
<g id="text_14">
<!-- 100 -->
- <g transform="translate(47.21 47.5678125)scale(0.12 -0.12)">
+ <g transform="translate(47.21 46.51125)scale(0.12 -0.12)">
<use xlink:href="#BitstreamVeraSans-Roman-31"/>
<use x="63.623046875" xlink:href="#BitstreamVeraSans-Roman-30"/>
<use x="127.24609375" xlink:href="#BitstreamVeraSans-Roman-30"/>
View
BIN  lib/matplotlib/tests/baseline_images/test_patches/patch_alpha_coloring.pdf
Binary file not shown
View
BIN  lib/matplotlib/tests/baseline_images/test_patches/patch_alpha_coloring.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
311 lib/matplotlib/tests/baseline_images/test_patches/patch_alpha_coloring.svg
@@ -0,0 +1,311 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Created with matplotlib (http://matplotlib.org/) -->
+<svg height="432pt" version="1.1" viewBox="0 0 576 432" width="576pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <defs>
+ <style type="text/css">
+*{stroke-linecap:butt;stroke-linejoin:round;}
+ </style>
+ </defs>
+ <g id="figure_1">
+ <g id="patch_1">
+ <path d="
+M0 432
+L576 432
+L576 0
+L0 0
+z
+" style="fill:#ffffff;"/>
+ </g>
+ <g id="axes_1">
+ <g id="patch_2">
+ <path d="
+M72 388.8
+L518.4 388.8
+L518.4 43.2
+L72 43.2
+z
+" style="fill:#ffffff;"/>
+ </g>
+ <g id="PathCollection_1">
+ <defs>
+ <path d="
+M369.6 -158.4
+C409.062 -158.4 446.913 -170.538 474.817 -192.141
+C502.721 -213.744 518.4 -243.049 518.4 -273.6
+C518.4 -304.151 502.721 -333.456 474.817 -355.059
+C446.913 -376.662 409.062 -388.8 369.6 -388.8
+C330.138 -388.8 292.287 -376.662 264.383 -355.059
+C236.479 -333.456 220.8 -304.151 220.8 -273.6
+C220.8 -243.049 236.479 -213.744 264.383 -192.141
+C292.287 -170.538 330.138 -158.4 369.6 -158.4
+z
+
+M369.6 -388.8
+L406.8 -323.483
+L498.465 -331.2
+L444 -273.6
+L498.465 -216
+L406.8 -223.717
+L369.6 -158.4
+L332.4 -223.717
+L240.735 -216
+L295.2 -273.6
+L240.735 -331.2
+L332.4 -323.483
+z
+" id="C0_0_2d53bfaf78"/>
+ </defs>
+ <g clip-path="url(#p7ff5b81e1d)">
+ <use style="fill:#ff0000;fill-opacity:0.5;stroke:#0000ff;stroke-dasharray:3.000000,5.000000,1.000000,5.000000;stroke-dashoffset:0.0;stroke-opacity:0.75;stroke-width:5.0;" x="0.0" xlink:href="#C0_0_2d53bfaf78" y="432.0"/>
+ </g>
+ </g>
+ <g id="patch_3">
+ <path clip-path="url(#p7ff5b81e1d)" d="
+M220.8 388.8
+C260.262 388.8 298.113 376.662 326.017 355.059
+C353.921 333.456 369.6 304.151 369.6 273.6
+C369.6 243.049 353.921 213.744 326.017 192.141
+C298.113 170.538 260.262 158.4 220.8 158.4
+C181.338 158.4 143.487 170.538 115.583 192.141
+C87.6785 213.744 72 243.049 72 273.6
+C72 304.151 87.6785 333.456 115.583 355.059
+C143.487 376.662 181.338 388.8 220.8 388.8
+z
+
+M220.8 158.4
+L258 223.717
+L349.665 216
+L295.2 273.6
+L349.665 331.2
+L258 323.483
+L220.8 388.8
+L183.6 323.483
+L91.9354 331.2
+L146.4 273.6
+L91.9354 216
+L183.6 223.717
+z
+" style="fill:#ff0000;fill-opacity:0.5;stroke:#0000ff;stroke-dasharray:3.000000,5.000000,1.000000,5.000000;stroke-dashoffset:0.0;stroke-opacity:0.75;stroke-width:5;"/>
+ </g>
+ <g id="matplotlib.axis_1">
+ <g id="xtick_1">
+ <g id="line2d_1">
+ <defs>
+ <path d="
+M0 0
+L0 -4" id="m93b0483c22" style="stroke:#000000;stroke-width:0.5;"/>
+ </defs>
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m93b0483c22" y="388.8"/>
+ </g>
+ </g>
+ <g id="line2d_2">
+ <defs>
+ <path d="
+M0 0
+L0 4" id="m741efc42ff" style="stroke:#000000;stroke-width:0.5;"/>
+ </defs>
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m741efc42ff" y="43.2"/>
+ </g>
+ </g>
+ </g>
+ <g id="xtick_2">
+ <g id="line2d_3">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="146.4" xlink:href="#m93b0483c22" y="388.8"/>
+ </g>
+ </g>
+ <g id="line2d_4">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="146.4" xlink:href="#m741efc42ff" y="43.2"/>
+ </g>
+ </g>
+ </g>
+ <g id="xtick_3">
+ <g id="line2d_5">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="220.8" xlink:href="#m93b0483c22" y="388.8"/>
+ </g>
+ </g>
+ <g id="line2d_6">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="220.8" xlink:href="#m741efc42ff" y="43.2"/>
+ </g>
+ </g>
+ </g>
+ <g id="xtick_4">
+ <g id="line2d_7">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="295.2" xlink:href="#m93b0483c22" y="388.8"/>
+ </g>
+ </g>
+ <g id="line2d_8">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="295.2" xlink:href="#m741efc42ff" y="43.2"/>
+ </g>
+ </g>
+ </g>
+ <g id="xtick_5">
+ <g id="line2d_9">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="369.6" xlink:href="#m93b0483c22" y="388.8"/>
+ </g>
+ </g>
+ <g id="line2d_10">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="369.6" xlink:href="#m741efc42ff" y="43.2"/>
+ </g>
+ </g>
+ </g>
+ <g id="xtick_6">
+ <g id="line2d_11">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="444.0" xlink:href="#m93b0483c22" y="388.8"/>
+ </g>
+ </g>
+ <g id="line2d_12">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="444.0" xlink:href="#m741efc42ff" y="43.2"/>
+ </g>
+ </g>
+ </g>
+ <g id="xtick_7">
+ <g id="line2d_13">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#m93b0483c22" y="388.8"/>
+ </g>
+ </g>
+ <g id="line2d_14">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#m741efc42ff" y="43.2"/>
+ </g>
+ </g>
+ </g>
+ </g>
+ <g id="matplotlib.axis_2">
+ <g id="ytick_1">
+ <g id="line2d_15">
+ <defs>
+ <path d="
+M0 0
+L4 0" id="m728421d6d4" style="stroke:#000000;stroke-width:0.5;"/>
+ </defs>
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m728421d6d4" y="388.8"/>
+ </g>
+ </g>
+ <g id="line2d_16">
+ <defs>
+ <path d="
+M0 0
+L-4 0" id="mcb0005524f" style="stroke:#000000;stroke-width:0.5;"/>
+ </defs>
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#mcb0005524f" y="388.8"/>
+ </g>
+ </g>
+ </g>
+ <g id="ytick_2">
+ <g id="line2d_17">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m728421d6d4" y="331.2"/>
+ </g>
+ </g>
+ <g id="line2d_18">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#mcb0005524f" y="331.2"/>
+ </g>
+ </g>
+ </g>
+ <g id="ytick_3">
+ <g id="line2d_19">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m728421d6d4" y="273.6"/>
+ </g>
+ </g>
+ <g id="line2d_20">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#mcb0005524f" y="273.6"/>
+ </g>
+ </g>
+ </g>
+ <g id="ytick_4">
+ <g id="line2d_21">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m728421d6d4" y="216.0"/>
+ </g>
+ </g>
+ <g id="line2d_22">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#mcb0005524f" y="216.0"/>
+ </g>
+ </g>
+ </g>
+ <g id="ytick_5">
+ <g id="line2d_23">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m728421d6d4" y="158.4"/>
+ </g>
+ </g>
+ <g id="line2d_24">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#mcb0005524f" y="158.4"/>
+ </g>
+ </g>
+ </g>
+ <g id="ytick_6">
+ <g id="line2d_25">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m728421d6d4" y="100.8"/>
+ </g>
+ </g>
+ <g id="line2d_26">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#mcb0005524f" y="100.8"/>
+ </g>
+ </g>
+ </g>
+ <g id="ytick_7">
+ <g id="line2d_27">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m728421d6d4" y="43.2"/>
+ </g>
+ </g>
+ <g id="line2d_28">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#mcb0005524f" y="43.2"/>
+ </g>
+ </g>
+ </g>
+ </g>
+ <g id="patch_4">
+ <path d="
+M72 43.2
+L518.4 43.2" style="fill:none;stroke:#000000;"/>
+ </g>
+ <g id="patch_5">
+ <path d="
+M518.4 388.8
+L518.4 43.2" style="fill:none;stroke:#000000;"/>
+ </g>
+ <g id="patch_6">
+ <path d="
+M72 388.8
+L518.4 388.8" style="fill:none;stroke:#000000;"/>
+ </g>
+ <g id="patch_7">
+ <path d="
+M72 388.8
+L72 43.2" style="fill:none;stroke:#000000;"/>
+ </g>
+ </g>
+ </g>
+ <defs>
+ <clipPath id="p7ff5b81e1d">
+ <rect height="345.6" width="446.4" x="72.0" y="43.2"/>
+ </clipPath>
+ </defs>
+</svg>
View
BIN  lib/matplotlib/tests/baseline_images/test_patches/patch_alpha_override.pdf
Binary file not shown
View
BIN  lib/matplotlib/tests/baseline_images/test_patches/patch_alpha_override.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
311 lib/matplotlib/tests/baseline_images/test_patches/patch_alpha_override.svg
@@ -0,0 +1,311 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Created with matplotlib (http://matplotlib.org/) -->
+<svg height="432pt" version="1.1" viewBox="0 0 576 432" width="576pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <defs>
+ <style type="text/css">
+*{stroke-linecap:butt;stroke-linejoin:round;}
+ </style>
+ </defs>
+ <g id="figure_1">
+ <g id="patch_1">
+ <path d="
+M0 432
+L576 432
+L576 0
+L0 0
+z
+" style="fill:#ffffff;"/>
+ </g>
+ <g id="axes_1">
+ <g id="patch_2">
+ <path d="
+M72 388.8
+L518.4 388.8
+L518.4 43.2
+L72 43.2
+z
+" style="fill:#ffffff;"/>
+ </g>
+ <g id="PathCollection_1">
+ <defs>
+ <path d="
+M369.6 -158.4
+C409.062 -158.4 446.913 -170.538 474.817 -192.141
+C502.721 -213.744 518.4 -243.049 518.4 -273.6
+C518.4 -304.151 502.721 -333.456 474.817 -355.059
+C446.913 -376.662 409.062 -388.8 369.6 -388.8
+C330.138 -388.8 292.287 -376.662 264.383 -355.059
+C236.479 -333.456 220.8 -304.151 220.8 -273.6
+C220.8 -243.049 236.479 -213.744 264.383 -192.141
+C292.287 -170.538 330.138 -158.4 369.6 -158.4
+z
+
+M369.6 -388.8
+L406.8 -323.483
+L498.465 -331.2
+L444 -273.6
+L498.465 -216
+L406.8 -223.717
+L369.6 -158.4
+L332.4 -223.717
+L240.735 -216
+L295.2 -273.6
+L240.735 -331.2
+L332.4 -323.483
+z
+" id="C0_0_2d53bfaf78"/>
+ </defs>
+ <g clip-path="url(#p7ff5b81e1d)">
+ <use style="fill:#ff0000;fill-opacity:0.25;stroke:#0000ff;stroke-dasharray:3.000000,5.000000,1.000000,5.000000;stroke-dashoffset:0.0;stroke-opacity:0.25;stroke-width:5.0;" x="0.0" xlink:href="#C0_0_2d53bfaf78" y="432.0"/>
+ </g>
+ </g>
+ <g id="patch_3">
+ <path clip-path="url(#p7ff5b81e1d)" d="
+M220.8 388.8
+C260.262 388.8 298.113 376.662 326.017 355.059
+C353.921 333.456 369.6 304.151 369.6 273.6
+C369.6 243.049 353.921 213.744 326.017 192.141
+C298.113 170.538 260.262 158.4 220.8 158.4
+C181.338 158.4 143.487 170.538 115.583 192.141
+C87.6785 213.744 72 243.049 72 273.6
+C72 304.151 87.6785 333.456 115.583 355.059
+C143.487 376.662 181.338 388.8 220.8 388.8
+z
+
+M220.8 158.4
+L258 223.717
+L349.665 216
+L295.2 273.6
+L349.665 331.2
+L258 323.483
+L220.8 388.8
+L183.6 323.483
+L91.9354 331.2
+L146.4 273.6
+L91.9354 216
+L183.6 223.717
+z
+" style="fill:#ff0000;opacity:0.25;stroke:#0000ff;stroke-dasharray:3.000000,5.000000,1.000000,5.000000;stroke-dashoffset:0.0;stroke-width:5;"/>
+ </g>
+ <g id="matplotlib.axis_1">
+ <g id="xtick_1">
+ <g id="line2d_1">
+ <defs>
+ <path d="
+M0 0
+L0 -4" id="m93b0483c22" style="stroke:#000000;stroke-width:0.5;"/>
+ </defs>
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m93b0483c22" y="388.8"/>
+ </g>
+ </g>
+ <g id="line2d_2">
+ <defs>
+ <path d="
+M0 0
+L0 4" id="m741efc42ff" style="stroke:#000000;stroke-width:0.5;"/>
+ </defs>
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m741efc42ff" y="43.2"/>
+ </g>
+ </g>
+ </g>
+ <g id="xtick_2">
+ <g id="line2d_3">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="146.4" xlink:href="#m93b0483c22" y="388.8"/>
+ </g>
+ </g>
+ <g id="line2d_4">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="146.4" xlink:href="#m741efc42ff" y="43.2"/>
+ </g>
+ </g>
+ </g>
+ <g id="xtick_3">
+ <g id="line2d_5">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="220.8" xlink:href="#m93b0483c22" y="388.8"/>
+ </g>
+ </g>
+ <g id="line2d_6">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="220.8" xlink:href="#m741efc42ff" y="43.2"/>
+ </g>
+ </g>
+ </g>
+ <g id="xtick_4">
+ <g id="line2d_7">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="295.2" xlink:href="#m93b0483c22" y="388.8"/>
+ </g>
+ </g>
+ <g id="line2d_8">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="295.2" xlink:href="#m741efc42ff" y="43.2"/>
+ </g>
+ </g>
+ </g>
+ <g id="xtick_5">
+ <g id="line2d_9">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="369.6" xlink:href="#m93b0483c22" y="388.8"/>
+ </g>
+ </g>
+ <g id="line2d_10">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="369.6" xlink:href="#m741efc42ff" y="43.2"/>
+ </g>
+ </g>
+ </g>
+ <g id="xtick_6">
+ <g id="line2d_11">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="444.0" xlink:href="#m93b0483c22" y="388.8"/>
+ </g>
+ </g>
+ <g id="line2d_12">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="444.0" xlink:href="#m741efc42ff" y="43.2"/>
+ </g>
+ </g>
+ </g>
+ <g id="xtick_7">
+ <g id="line2d_13">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#m93b0483c22" y="388.8"/>
+ </g>
+ </g>
+ <g id="line2d_14">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#m741efc42ff" y="43.2"/>
+ </g>
+ </g>
+ </g>
+ </g>
+ <g id="matplotlib.axis_2">
+ <g id="ytick_1">
+ <g id="line2d_15">
+ <defs>
+ <path d="
+M0 0
+L4 0" id="m728421d6d4" style="stroke:#000000;stroke-width:0.5;"/>
+ </defs>
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m728421d6d4" y="388.8"/>
+ </g>
+ </g>
+ <g id="line2d_16">
+ <defs>
+ <path d="
+M0 0
+L-4 0" id="mcb0005524f" style="stroke:#000000;stroke-width:0.5;"/>
+ </defs>
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#mcb0005524f" y="388.8"/>
+ </g>
+ </g>
+ </g>
+ <g id="ytick_2">
+ <g id="line2d_17">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m728421d6d4" y="331.2"/>
+ </g>
+ </g>
+ <g id="line2d_18">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#mcb0005524f" y="331.2"/>
+ </g>
+ </g>
+ </g>
+ <g id="ytick_3">
+ <g id="line2d_19">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m728421d6d4" y="273.6"/>
+ </g>
+ </g>
+ <g id="line2d_20">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#mcb0005524f" y="273.6"/>
+ </g>
+ </g>
+ </g>
+ <g id="ytick_4">
+ <g id="line2d_21">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m728421d6d4" y="216.0"/>
+ </g>
+ </g>
+ <g id="line2d_22">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#mcb0005524f" y="216.0"/>
+ </g>
+ </g>
+ </g>
+ <g id="ytick_5">
+ <g id="line2d_23">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m728421d6d4" y="158.4"/>
+ </g>
+ </g>
+ <g id="line2d_24">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#mcb0005524f" y="158.4"/>
+ </g>
+ </g>
+ </g>
+ <g id="ytick_6">
+ <g id="line2d_25">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m728421d6d4" y="100.8"/>
+ </g>
+ </g>
+ <g id="line2d_26">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#mcb0005524f" y="100.8"/>
+ </g>
+ </g>
+ </g>
+ <g id="ytick_7">
+ <g id="line2d_27">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="72.0" xlink:href="#m728421d6d4" y="43.2"/>
+ </g>
+ </g>
+ <g id="line2d_28">
+ <g>
+ <use style="stroke:#000000;stroke-width:0.5;" x="518.4" xlink:href="#mcb0005524f" y="43.2"/>
+ </g>
+ </g>
+ </g>
+ </g>
+ <g id="patch_4">
+ <path d="
+M72 43.2
+L518.4 43.2" style="fill:none;stroke:#000000;"/>
+ </g>
+ <g id="patch_5">
+ <path d="
+M518.4 388.8
+L518.4 43.2" style="fill:none;stroke:#000000;"/>
+ </g>
+ <g id="patch_6">
+ <path d="
+M72 388.8
+L518.4 388.8" style="fill:none;stroke:#000000;"/>
+ </g>
+ <g id="patch_7">
+ <path d="
+M72 388.8
+L72 43.2" style="fill:none;stroke:#000000;"/>
+ </g>
+ </g>
+ </g>
+ <defs>
+ <clipPath id="p7ff5b81e1d">
+ <rect height="345.6" width="446.4" x="72.0" y="43.2"/>
+ </clipPath>
+ </defs>
+</svg>
View
BIN  lib/matplotlib/tests/baseline_images/test_patches/patch_custom_linestyle.pdf
Binary file not shown
View
BIN  lib/matplotlib/tests/baseline_images/test_patches/patch_custom_linestyle.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
311 lib/matplotlib/tests/baseline_images/test_patches/patch_custom_linestyle.svg
@@ -0,0 +1,311 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Created with matplotlib (http://matplotlib.org/) -->
+<svg height="432pt" version="1.1" viewBox="0 0 576 432" width="576pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <defs>
+ <style type="text/css">
+*{stroke-linecap:butt;stroke-linejoin:round;}
+ </style>
+ </defs>
+ <g id="figure_1">
+ <g id="patch_1">
+ <path d="
+M0 432
+L576 432
+L576 0
+L0 0
+z
+" style="fill:#ffffff;"/>
+ </g>
+ <g id="axes_1">
+ <g id="patch_2">
+ <path d="
+M72 388.8
+L518.4 388.8
+L518.4 43.2
+L72 43.2
+z
+" style="fill:#ffffff;"/>
+ </g>
+ <g id="PathCollection_1">
+ <defs>
+ <path d="
+M369.6 -158.4
+C409.062 -158.4 446.913 -170.538 474.817 -192.141
+C502.721 -213.744 518.4 -243.049 518.4 -273.6
+C518.4 -304.151 502.721 -333.456 474.817 -355.059
+C446.913 -376.662 409.062 -388.8 369.6 -388.8
+C330.138 -388.8 292.287 -376.662 264.383 -355.059
+C236.479 -333.456 220.8 -304.151 220.8 -273.6
+C220.8 -243.049 236.479 -213.744 264.383 -192.141
+C292.287 -170.538 330.138 -158.4 369.6 -158.4
+z
+
+M369.6 -388.8
+L406.8 -323.483