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

Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix color cycle in sankey diagrams
  • Loading branch information
mdboom committed Nov 30, 2015
commit 2108b5786c8bacf0e5380e585e370986bd92455d
17 changes: 10 additions & 7 deletions lib/matplotlib/sankey.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
from matplotlib.transforms import Affine2D
from matplotlib import verbose
from matplotlib import docstring
from matplotlib import rcParams

__author__ = "Kevin L. Davies"
__credits__ = ["Yannick Copin"]
Expand Down Expand Up @@ -444,8 +445,6 @@ def add(self, patchlabel='', flows=None, orientations=None, labels='',
%(Patch)s

As examples, ``fill=False`` and ``label='A legend entry'``.
By default, ``facecolor='#bfd1d4'`` (light blue) and
``linewidth=0.5``.

The indexing parameters (*prior* and *connect*) are zero-based.

Expand Down Expand Up @@ -770,11 +769,15 @@ def _get_angle(a, r):
print("lrpath\n", self._revert(lrpath))
xs, ys = list(zip(*vertices))
self.ax.plot(xs, ys, 'go-')
patch = PathPatch(Path(vertices, codes),
fc=kwargs.pop('fc', kwargs.pop('facecolor',
'#bfd1d4')), # Custom defaults
lw=kwargs.pop('lw', kwargs.pop('linewidth', 0.5)),
**kwargs)
if rcParams['_internal.classic_mode']:
fc = kwargs.pop('fc', kwargs.pop('facecolor', '#bfd1d4'))
lw = kwargs.pop('lw', kwargs.pop('linewidth', 0.5))
else:
fc = kwargs.pop('fc', kwargs.pop('facecolor', None))
lw = kwargs.pop('lw', kwargs.pop('linewidth', None))
if fc is None:
fc = six.next(self.ax._get_patches_for_fill.prop_cycler)['color']
patch = PathPatch(Path(vertices, codes), fc=fc, lw=lw, **kwargs)
self.ax.add_patch(patch)

# Add the path labels.
Expand Down