Hi,
Ive been struggling to put together a working example for an hbar that gets its data from a columndatasource.
Im using bokeh 0.12.3 . Using an hbar as in
plot.hbar( right=[10,20,30,40,50], y=[1,2,3,4,5],height=1)
``
···
works just as expected. Trying the same with
mysource = ColumnDataSource(data=dict(right=[10,20,30,40,50],y=[1,2,3,4,5]))
plot.hbar(‘right’,‘y’,source=mysource)
``
doesn’t work at all. I’ve been at this problem for a better part of a day now and can’t seem to
a) find a working codeexample
b) understand the reference
c) get it working by trial and error
If any of you can show me how this might work, i’d really appreciate it. A
Bryan
October 18, 2016, 10:46pm
2
It's probably best to be explicit with keyword arguments:
plot.hbar(right='right', y='y', source=mysource)
You might also need to supply height=1 (or whatever)? Not sure what the default height is if you don't supply one.
There is an "order" that positional arguments are taken in, but it's not always obvious. I always use keyword arguments for any glyph that has more than simple (x,y) coordinate properties.
thanks,
Bryan
···
On Oct 18, 2016, at 5:30 PM, Rudelwolf <[email protected] > wrote:
Hi,
Ive been struggling to put together a working example for an hbar that gets its data from a columndatasource.
Im using bokeh 0.12.3 . Using an hbar as in
plot.hbar( right=[10,20,30,40,50], y=[1,2,3,4,5],height=1)
works just as expected. Trying the same with
mysource = ColumnDataSource(data=dict(right=[10,20,30,40,50],y=[1,2,3,4,5]))
plot.hbar('right','y',source=mysource)
doesn't work at all. I've been at this problem for a better part of a day now and can't seem to
a) find a working codeexample
b) understand the reference
c) get it working by trial and error
If any of you can show me how this might work, i'd really appreciate it. A
--
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/f2e1e851-894b-4a8b-825e-cc6d2ad8759a%40continuum.io\ .
For more options, visit https://groups.google.com/a/continuum.io/d/optout\ .
Hi,
My current solution (which works, surprisingly) is as follows:
x_data = numpy.random.uniform(0,20,5)
y_data = range(0,5)
plot = Figure(plot_width=600, plot_height=600, x_range=[0,20], y_range=[0,5])
source = ColumnDataSource(data=dict(y=y_data, right=x_data))
myglyph = HBar(y='y', right='right', left=0, height=0.8)
plot.add_glyph(source, myglyph)
which requires
from bokeh.models.glyphs import HBar
I’ll check your hint and get back to you tomorrow, thanks.
···
Not sure why you’re surprised.
p = figure(…)
p.hbar(...)
is just a slightly
shorter syntax convenience that does what you’ve written below.
···
On 10/18/16 4:18 PM, Rudelwolf wrote:
Hi,
My current solution (which works, surprisingly) is as
follows:
x_data = numpy.random.uniform(0,20,5)
y_data = range(0,5)
plot = Figure(plot_width=600, plot_height=600, x_range=[0,20], y_range=[0,5])
source = ColumnDataSource(data=dict(y=y_data, right=x_data))
myglyph = HBar(y='y', right='right', left=0, height=0.8)
plot.add_glyph(source, myglyph)
which requires
from bokeh.models.glyphs import HBar
I’ll check your hint and get back to you tomorrow, thanks.
– 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/d28ceaf9-4279-4fb7-94bf-9a5f51cc073a%40continuum.io
.
For more options, visit https://groups.google.com/a/continuum.io/d/optout .
–
Sarah Bird
Developer, Bokeh