Display hover data in Bokeh scatter violin and stacked bar charts

Hi Sarah,

So I was able to get the hover working on bokeh 0.12.2 using vbars and manipulating my data. This is great! However, now I am wondering if it is possible to have a different hover for different stacks in a stacked bar chart. I want the hover to display the value of that stack.

Thanks,
Reuben

···

On Friday, August 26, 2016 at 4:12:32 PM UTC-4, Sarah Bird wrote:

That’d be cool!

  On 8/26/16 11:29 AM, Reuben Jacobs > wrote:
    I may be able to insert a custom script inside the

HTML of a custom tooltip!

    On Thursday, August 25, 2016 at 9:50:02 AM UTC-4, Reuben Jacobs > > wrote:
        Is there a way to access the hover

functionality through JS on the client side? I.E. maybe a
way to send to the JS the value that is being hovered upon
to I can do a hover in JS.

        On Wednesday, August 24, 2016 at 4:52:21 PM UTC-4, Sarah > > > Bird wrote:
                  I have a

hunch that going the bokeh.plotting route
will result in more readable / maintainable
code - but you are going to have to do a little more work to
get your plot out.

Having said that I
basically don’t use bokeh.charts
so I’m
not the best person for advice
on charts hacking.

On 8/24/16 1:41 PM, Reuben Jacobs wrote:

Sarah,

                Ah, sorry. To clarify then, I meant the bokeh.charts

doesn’t support getting hover other than x and y
innately. I tried using a ColulmnDataSource as the
data source for the plot, but I was unable to do so
succesfully. I would probably need to further look
at my data and restructure it and shift away from
mpl.to_boke() if I am going to try that any further.
As for digging around, these charts have around 200
GlyphRenderer each with extremely generic names :cry:
It will be probably be quite the struggle, but I can
give it a go.

Thanks,

Reuben

                  On Wednesday, August 24, 2016 at 4:24:18 PM UTC-4, > > > > > Sarah Bird wrote:

Hi Reuben,

                        It's important to not get confused between

the bokeh.charts high level interface and
bokeh’s capabilities

                        Your comment "While I know bokeh doesn't

support showing data other than the x or y
axis innately" isn’t accurate.

http://bokeh.pydata.org/en/latest/docs/user_guide/tools.html#custom-tooltip ,
https://demo.bokehplots.com/apps/gapminder,
http://bokeh.pydata.org/en/latest/docs/gallery/texas.html ,
http://bokeh.pydata.org/en/latest/docs/gallery/color_sliders.html ,
plus lots of examples in the examples
directory demonstrate showing hover
information for information other than that
on the x or y axis.

                        Bokeh plots, specifically bokeh glyph

renderers (line/circle/patches), are
“powered” by a ColumnDataSource. Your hover
tool can reference any column in your
ColumnDataSource - as demonstrated by all
these examples.

                        However, when using bokeh.charts your data

gets automagically transformed for you and
the ColumnDataSource does not resemble the
dataframe you pass into it.

                      You need to find a way of adding the columns

you want to display in your hover into the
ColumnDataSource(s) that are driving your
plot.

                      Your options:



                      1) dig around a bit in the chart output to

find the column data source and add some new
columns

                      2) don't use charts, make the ColumnDataSource

yourself and build your plot a little more
manually.

                      Sincerely,



                      Sarah Bird

On 8/24/16 1:02 PM, Reuben Jacobs wrote:

                          Like the title says I have

data I want to display in my hover for
both violin and stacked bar charts. While
I know bokeh doesn’t support showing data
other than the x or y axis innately, I
came across a solution for this problem
for scatter charts. The solution can be
found here
[

                            ](http://goog_892416094)

[Jupyter Notebook Viewer

                            ](http://nbviewer.jupyter.org/github/billsanto/notebook_examples/blob/master/bokeh_hover_test.ipynb)
                            I am trying to implement this

solution but I fear it is not possibly
for violin and stacked bar charts. Does
anyone know how to display hover tools
for data that is in the original
dataFrame but not the x or y axis
specifically for stacked bar or violin
charts?

                            I tried implementing the solution

found above, but I keeped receiving
KeyErrors when trying to access the
GlyphRenderer of my chart. Obviously for
the stacked bar chart and violin chart
there are 100+ GlyphRenderer which is
why I believe this solution is not
working.

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/2ca89935-6b40-4939-9112-8bbc09e263d5%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/2ca89935-6b40-4939-9112-8bbc09e263d5%40continuum.io?utm_medium=email&utm_source=footer).

                        For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).


Sarah Bird
Developer, Bokeh

                          [ <img alt="Continuum Analytics" src="https://lh6.googleusercontent.com/proxy/VYgVjggTk1hCXSN9wFkffE3I6kxTvJ51tT4KvDXOuKbs1WyFG66k7kt2-vkDimbyxfWtP-d1paJmstMYhPPnDYSUF4rLPoYM2GM2QFM=w5000-h5000" style="width:150px;min-height:30px" height="30px" width="150px"> ](http://continuum.io)

              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/d61a2f07-652d-46c4-9b2b-be190cbcd948%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/d61a2f07-652d-46c4-9b2b-be190cbcd948%40continuum.io?utm_medium=email&utm_source=footer).

              For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).


Sarah Bird
Developer, Bokeh

                [ <img alt="Continuum Analytics" src="https://lh6.googleusercontent.com/proxy/VYgVjggTk1hCXSN9wFkffE3I6kxTvJ51tT4KvDXOuKbs1WyFG66k7kt2-vkDimbyxfWtP-d1paJmstMYhPPnDYSUF4rLPoYM2GM2QFM=w5000-h5000" style="width:150px;min-height:30px" height="30px" width="150px"> ](http://continuum.io)

  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/0dc319cb-8a2d-4456-8b93-9852e3e3967f%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/0dc319cb-8a2d-4456-8b93-9852e3e3967f%40continuum.io?utm_medium=email&utm_source=footer).

  For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).


Sarah Bird
Developer, Bokeh

    [
      <img alt="Continuum Analytics" src="https://lh6.googleusercontent.com/proxy/VYgVjggTk1hCXSN9wFkffE3I6kxTvJ51tT4KvDXOuKbs1WyFG66k7kt2-vkDimbyxfWtP-d1paJmstMYhPPnDYSUF4rLPoYM2GM2QFM=w5000-h5000" style="width:150px;min-height:30px" height="30px" width="150px">
    ](http://continuum.io)