Skip to content

Commit

Permalink
Exposed option to set Sankey font size
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Mar 1, 2019
1 parent c7da308 commit 8f83fbe
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion holoviews/plotting/mpl/sankey.py
Expand Up @@ -44,6 +44,8 @@ class SankeyPlot(GraphPlot):

filled = True

style_opts = GraphPlot.style_opts + ['label_text_font_size']

def get_extents(self, element, ranges, range_type='combined'):
"""
A Chord plot is always drawn on a unit circle.
Expand Down Expand Up @@ -124,7 +126,7 @@ def _update_labels(self, ax, data, style):
if 'text' not in data:
return []

fontsize = style.get('text_font_size', 8)
fontsize = style.get('label_text_font_size', 8)
align = 'left' if self.label_position == 'right' else 'right'
labels = []
for text in data['text']:
Expand All @@ -135,6 +137,7 @@ def _update_labels(self, ax, data, style):
return labels

def init_artists(self, ax, plot_args, plot_kwargs):
fontsize = plot_kwargs.pop('label_text_font_size')
artists = super(SankeyPlot, self).init_artists(ax, plot_args, plot_kwargs)
groups = [g for g in self._style_groups if g != 'node']
node_opts = filter_styles(plot_kwargs, 'node', groups, ('s', 'node_s'))
Expand All @@ -144,6 +147,7 @@ def init_artists(self, ax, plot_args, plot_kwargs):
if 'c' in node_opts:
node_opts['array'] = node_opts.pop('c')
artists['rects'] = ax.add_collection(PatchCollection(rects, **node_opts))
plot_kwargs['label_text_font_size'] = fontsize
artists['labels'] = self._update_labels(ax, plot_args, plot_kwargs)
return artists

Expand Down

0 comments on commit 8f83fbe

Please sign in to comment.