Small working example attached.
cross_hair.py (1.21 KB)
···
On 2017-09-13 15:39, Web Busino wrote:
Hi Alessandro,
I have multiple plots with the same time-axis (x) but with a
specific offset between the different plots.
And I needed a tool to inspect data in the different plots.I used a simple segment ()
to draw a vertical line on each plot.
Added a DataSource and use it as source of the segment in all
plots.
To get the the mouse-position data I use the HoverTool ()
and define a callback, that is updating the datasource.
Here are some codesnippets that could be useful. (The tool was
implemented 1 year ago. I think some syntax have to be
changed!!!)# Define a DataSource data = dict(x=[0]*n_plots) line_source = ColumnDataSource(data=data) js = ''' var geometry = cb_data['geometry']; $.each(poi_time_shift, function(key, value){ line_source.data[key] = [geometry.x]; }); line_source.trigger('change'); ''' # Add a segment to the plot for plot in plots: plot.segment(x0='x', y0=0, x1='x', y1=2000, line_width=1, source=line_source) hover = HoverTool(tooltips=None, point_policy='follow_mouse', callback=CustomJS(code=js, args={'line_source': line_source}))
Hope this helps.
-- 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 .
To post to this group, send email to .
To view this discussion on the web visit .
For more options, visit .
http://bokeh.pydata.org/en/latest/docs/reference/models/glyphs/segment.html
http://bokeh.pydata.org/en/latest/docs/reference/models/tools.html#bokeh.models.tools.HoverTool
On 2017-09-13 14:48, Alessandro
Pocaterra wrote:
I have 2 linked plots, so they zoom and pan
together.
I would like to show a vertical line based on mouse
position (the green one in the attached image) on both of
them.Is there an example of this somewhere?
Thank you in advance
–
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/de943630-1950-48ab-acb6-ce77c30ecca2%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/de943630-1950-48ab-acb6-ce77c30ecca2%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).
[email protected]
[email protected]
https://groups.google.com/a/continuum.io/d/msgid/bokeh/28cfed7c-cdad-4f55-4e27-a874d7a18c43%40busino.ch
https://groups.google.com/a/continuum.io/d/optout