bokeh

How to plot bar graph interactively based on value of dropdown widget in bokeh python?

↘锁芯ラ 提交于 2020-01-25 12:48:09
问题 I want to plot the bar graph based value of dropdown widget. Code import pandas as pd from bokeh.io import output_file, show from bokeh.layouts import widgetbox from bokeh.models.widgets import Dropdown from bokeh.plotting import curdoc from bokeh.charts import Bar, output_file,output_server, show #use output_notebook to visualize it in notebook df=pd.DataFrame({'item':["item1","item2","item2","item1","item1","item2"],'value':[4,8,3,5,7,2]}) menu = [("item1", "item1"), ("item2", "item2")]

plot image with interpolation in Python Bokeh like matplotlib?

爱⌒轻易说出口 提交于 2020-01-25 10:55:13
问题 Is there any way to plot 2D array as an image using Bokeh with interpolation like in Matplotlib? I am able to plot using an example: https://docs.bokeh.org/en/latest/docs/gallery/image.html However, the image is to coarse. I like the way interpolation work in Matplotlib: https://matplotlib.org/gallery/images_contours_and_fields/interpolation_methods.html I tried to perform interpolation beforehand but the matrix size now is to big. 回答1: If you are working with a large dataset then you could

Datetime on an X Axis in Bokeh

谁都会走 提交于 2020-01-25 08:29:07
问题 I'm having trouble understanding how datetime works in Bokeh. My code is outputting milliseconds on the x axis, which seems to be the default if the axis type is 'datetime', but I would like to have it separated by every 5 years. How can I accomplish this in Bokeh? The dates are before 1950 so I can't use a timestamp. When I exclude the datetime axis type, it displays every single value as a tick on the x axis. When I try to change the inputted data as a datetime object, Bokeh rejects it. I

How to remove NaN in bokeh table

寵の児 提交于 2020-01-25 08:22:08
问题 I am using bokeh widgets table to show data, I use Dateformatter to format date, but null date is showing 'NaN/NaN/NaN' in Bokeh table, how to remove these NaN? import numpy as np from bokeh.io import output_notebook output_notebook() c, conn = connection() sqlString = "SELECT * FROM Database.SQLTable;" df = pd.read_sql_query(sqlString, conn) c.close() conn.close() #df = df.replace(np.nan, '', regex=True) cols = [ TableColumn(field='ID', title='ID'), TableColumn(field='Activity_Title', title=

How to access and update Bokeh plots or widgets using an external JavaScript code?

烈酒焚心 提交于 2020-01-25 04:35:05
问题 I have a Bokeh plot which is controlled by a time Bokeh slider. I am trying to set the time of the slider and the corresponding plotted data to the current time of the browser by clicking on a button. I know how to do the same thing if everything has been entirely developed in JS. But I am writing an external JS function embedded in the HTML file and I don't know how to access the Bokeh objects (in this case the Slider) and manipulate them. I can only use the callback functions to start from

Python Bokeh CustomJS: Debugging a JavaScript callback for the Taping-Tool

[亡魂溺海] 提交于 2020-01-25 01:25:08
问题 I am working with Python 3.6.2 and Bokeh 1.0.4 to create a custom JavaScript callback in my plot. By tapping on one of the points in the plot, I'd like all points sharing the same attribute in the id-column to be highlighted. Iterating over all datapoints with JavaScript and manipulating the respective 'selected'-attribute in the ColumnDataSource-object should do the trick. Unfortunately I can not figure out how to correct this code. # Import packages from bokeh.plotting import figure, show

Cannot populate Hover Tooltip values in bokeh network plot

▼魔方 西西 提交于 2020-01-25 01:25:05
问题 I have a network, with nodes as such: [('user_0', {'pk': 2, 'tname': 'user_0'}), ('user_1', {'pk': 3, 'tname': 'user_1'}), ('user_2', {'pk': 4, 'tname': 'user_2'}), ('user_3', {'pk': 5, 't': 'user_3'}), ('user_4', {'pk': 6, 't': 'user_4'})] And my plotting code is essentially a combination of the two examples in the documentation. It's as follows: # Create plot plot = Plot(plot_width=600, plot_height=600, x_range=Range1d(-1.1,1.1), y_range=Range1d(-1.1,1.1)) # Set title plot.title.text =

How to host a Datashader-Bokeh Interactive Map as a web application?

﹥>﹥吖頭↗ 提交于 2020-01-24 22:18:00
问题 I have recently created an interactive Datashader-Bokeh Interactive Map that looks like this NYC Taxi Example on a Jupyter Notebook. The dynamic aggregation works beautifully when I run the code locally on my mac. My question is, is the current technology possible to host this as a web application - e.g. a web app without that Jupyter Notebook interface. And if so, how? I've come across some articles (this and this) that suggest HoloViews might be an appropriate "glue" to stitch up Datashader

How to host a Datashader-Bokeh Interactive Map as a web application?

烈酒焚心 提交于 2020-01-24 22:16:27
问题 I have recently created an interactive Datashader-Bokeh Interactive Map that looks like this NYC Taxi Example on a Jupyter Notebook. The dynamic aggregation works beautifully when I run the code locally on my mac. My question is, is the current technology possible to host this as a web application - e.g. a web app without that Jupyter Notebook interface. And if so, how? I've come across some articles (this and this) that suggest HoloViews might be an appropriate "glue" to stitch up Datashader

Is Bokeh compatible with Google App Engine?

房东的猫 提交于 2020-01-24 21:50:54
问题 I've been working through this Udacity web dev course and wanted to try embedding a simple bokeh plot into a web page using this example. Running dev_appserver.py gives the error: ERROR 2017-01-22 14:35:30,358 wsgi.py:263] Traceback (most recent call last): File "C:\Users\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform \google_appengine\google\appengine\runtime\wsgi.py", line 240, in Handle handler = _config_handle.add_wsgi_middleware(self._LoadHandler()) File "C:\Users\AppData\Local