In every other glyph, a string value is always interpreted as “column label”. This change brings consistency to all Bokeh glyphs. Doing that reduces unnecessary code-paths branches and complications in the implementation, but much more importantly allows all the glyphs to be documented straightforwardly, without confusing “but things are different for this special case” exceptions.
One unavoidable confusing aspect of Bokeh is the implications of the cross language serialization, where things are defined in one place and time in one language, but not actually used until a later time and place in a different language. The Bokeh python binding is not assuming you are using a column data source, it simply has no way whatsoever of knowing you won’t add one at some point. In this case, the consistency and explicitness described above is more valuable than trying to make guesses about what users want, that are sometimes convenient, except when they aren’t.
On May 21, 2015, at 5:08 PM, Chris Lindner [email protected] wrote:
Okay, in fiddling with this, I think I found the fix. It looks like Bokeh 0.9 will assume your text is a label unless you put it in a list. Thus, the new Bokeh way to do this is
glyph = Text(x=, y=, text=[“hello world”], angle=0.3, text_color="#96deb3")
This is kind of an annoying change. I didn’t tell Bokeh I wanted to use a ColumnDataSource, so why is it assuming I do?
On Thursday, May 21, 2015 at 4:59:27 PM UTC-5, Chris Lindner wrote:
If I try to add a Text Glyph to the example in https://github.com/bokeh/bokeh/blob/master/tests/glyphs/Text.py with
glyph = Text(x=0, y=1, text=“hello world”, angle=0.3, text_color="#96deb3")
The glyph text comes out as “NaN” instead of “hello world.”
Similarly, if I try to add a text glyph to a figure like this
,text = 'Cluster Information'
I get the error:
RuntimeError: Column name ‘Cluster Information’ does not appear in data source <bokeh.models.sources.ColumnDataSource object at 0x11610e190>
as though it’s looking in a ColumnDataSource, even though I haven’t specified one. This used to work in 0.82. How can I explicitly define a text glyph without having to use a ColumnDataSource in 0.9?
You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/0680a002-7574-4abb-984a-242c76f1f3bf%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.