bokeh

How to add multiple Hover Tools without showing multiple icons in the toolbar?

走远了吗. 提交于 2019-12-12 17:27:07
问题 Following the example here I have added multiple tooltips to a stacked bar chart. I also want to have other tools available in the toolbar above the plot, but when multiple hover tools are created using the process in the example it creates multiple icons in the tool bar, leaving it looking messy like this: Is there a way to add multiple hover tools, and have the toolbar visible with other tools in it, but not duplicate the hover icon? 回答1: Just set the toggleable attribute to False . Check

How can I get the bokeh hover tool to snap to the data?

a 夏天 提交于 2019-12-12 16:38:50
问题 I would like the bokeh hover tool to snap to the data points instead of interpolating the mouse position on the line. Here's the code that I thought would do it, but I'm still getting interpolated data in the display. from bokeh.plotting import figure, output_file, show from bokeh.models import HoverTool # prepare some data x = [0.1, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0] y0 = [i**2 for i in x] y1 = [10**i for i in x] y2 = [10**(i**2) for i in x] # output to static HTML file output_file("log_lines

Hide legend in bokeh plot

左心房为你撑大大i 提交于 2019-12-12 11:16:37
问题 LS, Bokeh plot automatically generates a legend for a plot. How can I hide (not show at all) the legend in a Bokeh plot ? I tried: legend = 'none' . But no success. Thanks 回答1: If I can just expand this a little - legend=False is the correct way to make the Bokeh legend invisible, but it's used within the creation of the plot itself, rather than being called as an attribute of the plot object. By which I mean, write from bokeh.charts import Scatter myPlot = Scatter(foo, bar, legend=False)

How do I extract data from a Bokeh ColumnDatasource

元气小坏坏 提交于 2019-12-12 10:54:43
问题 I was trying to avoid using a ColumnDataSource and instead of that I was passing pandas dataframe columns directly to Bokeh plots. Soon though I had to implement a HoverTool which requires to have the data in a ColumnDataSource. So, I started using ColumnDataSource. Now, I was creating a box annotation and I had to use the maximum value of a certain column from my data to define the top border of the box. I can do that easily using pandas: low_box = BoxAnnotation( top=flowers['petal_width']

Bokeh's equivalent to matplotlib subplots

可紊 提交于 2019-12-12 08:37:52
问题 I am looking for a way to create a plot the containing several subplots like fig, (ax0, ax1) = plt.subplots(nrows=2, sharex=True) would do in matplotlib, which then can be addressed by ax0 and ax1 . Is there a way to do something similar in Bokeh? In the bokeh examples gallery I only found single plots. 回答1: I think the simpler example you can find is: import numpy as np import bokeh.plotting as bk_plotting import bokeh.models as bk_models # for the ipython notebook bk_plotting.output

How to get a Bokeh Server to display a DataTable

≡放荡痞女 提交于 2019-12-12 06:39:20
问题 I can get the DataTable to display in a Jupyter Notebook without any issues. But i haven't been able to get it to display via the Server (curdoc().add_root()). When I attempt to access it I don't get any errors in the server window and just a blank page on the browser. I just see the following: 2017-04-23 16:07:51,188 Starting Bokeh server on port 5006 with applications at paths ['/myapp'] 2017-04-23 16:07:51,188 Starting Bokeh server with process id: 7484 2017-04-23 16:07:55,365 200 GET

Bokeh: Python: Cannot get HTML source for bar plots in Bokeh

戏子无情 提交于 2019-12-12 05:37:04
问题 I'm trying to retrieve html code for embedding from a Bokeh bar plot. This example works fine: from bokeh.resources import CDN from bokeh.plotting import circle from bokeh.embed import autoload_static plot = circle([1,2], [3,4]) div = notebook_div(plot) js, tag = autoload_static(plot, CDN, "some/path") jkl = HTML(div) print div However, if I try the same code with plot = Bar(...) I get the error: -----> div = notebook_div(plot) 'Bar' object has no attribute 'ref' Is there a better way to

TimeSeries plots with Bokeh

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 05:16:57
问题 NOTE FROM BOKEH MAINTAINER : The bokeh.charts API including TimeSeries was deprecated and removed a long time ago. This question is not relevant as-is to any recent or future versions of Bokeh. To plot time series, use the stable and supported bokeh.plotting API. Some examples can be found here. I am trying to plot a Timeseries plot with categories. xaxis_values: startTIme yaxis_values: count groupby: day Every day has 24 hours data sets and like this the entire dataset has more than 100 days

OpenURL in bokeh - open in same tab

只愿长相守 提交于 2019-12-12 05:06:38
问题 Considering the example below from the Bokeh Docs, is there a way to adjust the TapTool so that when I click on a circle I'm taken to the url on the same tab rather than opening a new tab? The docstring suggests that the only behavior is to open a new tab, but perhaps there's a CustomJS workaround or some other hack to get around this? from bokeh.models import ColumnDataSource, OpenURL, TapTool from bokeh.plotting import figure, output_file, show output_file("openurl.html") p = figure(plot

Adding error bars on top of bar charts in Bokeh

别来无恙 提交于 2019-12-12 04:48:17
问题 I am trying to create bar chart with error bars on top. I looked at the following answer to generate such view. My code works until I do p.line(y_err_x, y_err_y, color="black" ) presumably due to x axis indexing as I get the following error: Unable to get property 'A' of undefined or null reference What is the appropriate use? Thanks in advance! from bokeh.io import show, output_notebook from bokeh.models import ColumnDataSource from bokeh.plotting import figure from bokeh.transform import