After about 2-3 hours of trying to change the label size of my (amazingly generated and awesome looking) sankey plot, I simply can _not_ figure out how to change it. I have tried sublabel_size, node_size and just about every legal option available.
How do we change sankey label size
Does the 'label_text_font_size' option work?
No, it does not - it says that this is not compatible across all extensions (current one used is matplotlib - bokeh is not great with ssh CLI environment)
~text_font_size then.~ Nevermind I see that option was indeed never exposed I'll add it shortly.
Great to hear
[holoviews 1.11.2]
Hello there & thanks for your awesome work!
I would like to change the font sizes, too. So just to avoid a misunderstanding:
When using the bokeh extension, I can only change the font size of the plot title, not the labels within the plot. Is this expected behaviour or am I missing something?
Misspelling e.g. label_text_font_size2 shows that label_text_font_size should be available.
However, using label_text_font_size gives another error "expected an element of [...] FontSize, got 15"
I am using holoviews in a bokeh server with bokeh serve testfile.py
from bokeh.io import curdoc
from bokeh.layouts import layout
import holoviews as hv
from holoviews.plotting.bokeh import BokehRenderer
hv.extension('bokeh')
hv_sankey = hv.Sankey([
['A', 'X', 5],
['A', 'Y', 7],
['A', 'Z', 6],
['B', 'X', 2],
['B', 'Y', 9],
['B', 'Z', 4]]
).options(width=600, height=400,
node_width=100, # default 15
fontsize=25, # Changes title font size
# label_text_font_size2=15, # ValueError "Unexpected option 'label_text_font_size2' for Sankey type across all extensions. Similar options for current extension ('bokeh') are: ['label_text_font_size']"
# label_text_font_size=15, # error "expected an element of FontSize, got 15"
)
# Get HoloViews plot and attach document
doc = curdoc()
hvplot = BokehRenderer.get_plot(hv_sankey, doc)
hvplot.state.title.text = 'The Title!' # is affected by "fontsize=25"
# Make a bokeh layout and add it as the Document root
plot = layout([hvplot.state])
doc.add_root(plot)
The addition of the label_text_font_size option was only just merged. It'll be available as part of holoviews 1.12.0
Hi there,
in the meantime, holoviews has progressed to 1.12.5 and I still get the same error as described above.
To reproduce:
testfile.pybokeh serve testfile.py --show (My bokeh version is 1.3.4)label_text_font_size=15I am still not sure weather this is even supported for the bokeh extension, since #3535 only changed the mpl extension(?). It would be awesome to have someone confirm this is still a bug, and not just specific to my machine. I tested it on both Windows and Linux.
My full error message is
File "options.py", line 200, in __exit__:
raise AbbreviatedException(etype, value, traceback) Traceback (most recent call last):
File "/home/joris/miniconda3/lib/python3.6/site-packages/holoviews/plotting/bokeh/element.py", line 1438, in _init_glyphs
renderer, glyph = self._init_glyph(plot, mapping.get(key, {}), properties, key)
File "/home/joris/miniconda3/lib/python3.6/site-packages/holoviews/plotting/bokeh/sankey.py", line 82, in _init_glyph
return super(SankeyPlot, self)._init_glyph(plot, mapping, properties, key)
File "/home/joris/miniconda3/lib/python3.6/site-packages/holoviews/plotting/bokeh/element.py", line 1512, in _init_glyph
renderer = getattr(plot, plot_method)(**dict(properties, **mapping))
File "fakesource", line 9, in text
File "/home/joris/miniconda3/lib/python3.6/site-packages/bokeh/plotting/helpers.py", line 857, in func
glyph = _make_glyph(glyphclass, kwargs, glyph_ca)
File "/home/joris/miniconda3/lib/python3.6/site-packages/bokeh/plotting/helpers.py", line 398, in _make_glyph
return glyphclass(**kws)
File "/home/joris/miniconda3/lib/python3.6/site-packages/bokeh/model.py", line 307, in __init__
super(Model, self).__init__(**kwargs)
File "/home/joris/miniconda3/lib/python3.6/site-packages/bokeh/core/has_props.py", line 253, in __init__
setattr(self, name, value)
File "/home/joris/miniconda3/lib/python3.6/site-packages/bokeh/core/has_props.py", line 280, in __setattr__
super(HasProps, self).__setattr__(name, value)
File "/home/joris/miniconda3/lib/python3.6/site-packages/bokeh/core/property/descriptors.py", line 545, in __set__
self._internal_set(obj, value, setter=setter)
File "/home/joris/miniconda3/lib/python3.6/site-packages/bokeh/core/property/descriptors.py", line 766, in _internal_set
value = self.property.prepare_value(obj, self.name, value)
File "/home/joris/miniconda3/lib/python3.6/site-packages/bokeh/core/property/bases.py", line 327, in prepare_value
raise e
File "/home/joris/miniconda3/lib/python3.6/site-packages/bokeh/core/property/bases.py", line 320, in prepare_value
self.validate(value)
File "/home/joris/miniconda3/lib/python3.6/site-packages/bokeh/core/property/dataspec.py", line 298, in validate
super(FontSizeSpec, self).validate(value, detail)
File "/home/joris/miniconda3/lib/python3.6/site-packages/bokeh/core/property/either.py", line 116, in validate
raise ValueError(msg)
ValueError: expected an element of either String, Dict(Enum('expr', 'field', 'value', 'transform'), Either(String, Instance(Transform), Instance(Expression), FontSize)) or FontSize, got 15
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/joris/miniconda3/lib/python3.6/site-packages/bokeh/application/handlers/code_runner.py", line 179, in run
exec(self._code, module.__dict__)
File "/mnt/c/Users/nettelstroth/Documents/07 Python/tests/holoviews-sankey.py", line 30, in <module>
hvplot = BokehRenderer.get_plot(hv_sankey, doc)
File "/home/joris/miniconda3/lib/python3.6/site-packages/holoviews/plotting/bokeh/renderer.py", line 135, in get_plot
plot = super(BokehRenderer, self_or_cls).get_plot(obj, renderer, **kwargs)
File "/home/joris/miniconda3/lib/python3.6/site-packages/holoviews/plotting/renderer.py", line 207, in get_plot
plot.update(init_key)
File "/home/joris/miniconda3/lib/python3.6/site-packages/holoviews/plotting/plot.py", line 612, in update
return self.initialize_plot()
File "/home/joris/miniconda3/lib/python3.6/site-packages/holoviews/plotting/bokeh/element.py", line 2079, in initialize_plot
child = subplot.initialize_plot(ranges, plot, plots)
File "/home/joris/miniconda3/lib/python3.6/site-packages/holoviews/plotting/bokeh/element.py", line 1268, in initialize_plot
self._init_glyphs(plot, element, ranges, source)
File "/home/joris/miniconda3/lib/python3.6/site-packages/holoviews/plotting/bokeh/sankey.py", line 59, in _init_glyphs
super(SankeyPlot, self)._init_glyphs(plot, element, ranges, source)
File "/home/joris/miniconda3/lib/python3.6/site-packages/holoviews/plotting/bokeh/graphs.py", line 355, in _init_glyphs
self, plot, element, ranges, source, data, mapping, style)
File "/home/joris/miniconda3/lib/python3.6/site-packages/holoviews/plotting/bokeh/element.py", line 1438, in _init_glyphs
renderer, glyph = self._init_glyph(plot, mapping.get(key, {}), properties, key)
File "/home/joris/miniconda3/lib/python3.6/site-packages/holoviews/core/options.py", line 200, in __exit__
raise AbbreviatedException(etype, value, traceback)
holoviews.core.options.AbbreviatedException: ValueError: expected an element of either String, Dict(Enum('expr', 'field', 'value', 'transform'), Either(String, Instance(Transform), Instance(Expression), FontSize)) or FontSize, got 15
bokeh expects some unit when you specify a font size, e.g. label_text_font_size='15pt'
Wow, thank you very much! I did try the string '15', but did not realize the requirement for a unit. Awesome!
Most helpful comment
~
text_font_sizethen.~ Nevermind I see that option was indeed never exposed I'll add it shortly.