From 8f83fbe6785868751907a8077e98c529a1ffbd28 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Fri, 1 Mar 2019 13:39:31 +0000 Subject: [PATCH] Exposed option to set Sankey font size --- holoviews/plotting/mpl/sankey.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/holoviews/plotting/mpl/sankey.py b/holoviews/plotting/mpl/sankey.py index 36cd3f1807..7fbf868d2c 100644 --- a/holoviews/plotting/mpl/sankey.py +++ b/holoviews/plotting/mpl/sankey.py @@ -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. @@ -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']: @@ -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')) @@ -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