bokeh

What is a fast and proper way to refresh/update plots in Bokeh (0.11) server app?

不羁的心 提交于 2019-12-03 00:22:40
I have a bokeh (v0.11) serve app that produces a scatter plot using (x,y) coordinates from a data frame. I want to add interactions such that when a user either selects points on the plot or enters the name of comma-separated points in the text box (ie. "p55, p1234"), then those points will turn red on the scatter plot. I have found one way to accomplish this (Strategy #3, below) but it is terribly slow for large dataframes. I would think there is a better method. Can anyone help me out? Am I missing some obvious function call? Strategy 1 (<1ms for 100 points) drills into the ColumnDataSource

Bokeh graph doesn't plot properly

时光毁灭记忆、已成空白 提交于 2019-12-02 20:13:29
问题 The following code doesn't generate a graph: import pandas import numpy as np from bokeh.plotting import figure, show, output_file from bokeh.io import output_notebook from datetime import datetime output_notebook() TOOLS="hover,crosshair,pan,wheel_zoom,zoom_in,zoom_out,box_zoom,undo,redo,reset,\ tap,save,box_select,poly_select,lasso_select," df = pandas.read_csv('./logs.csv') df['datetime'] = pd.to_datetime(df['datetime']) xvals = df['datetime'].dt.strftime('%Y-%m-%d') yvals = df['datetime']

Bokeh Widget Slicing data

大憨熊 提交于 2019-12-02 19:29:17
问题 I am trying to create a plot using bokeh to visualize my data on IPython Notebook. I want to add some widgets to make it more interactive. Below is an example of the codes. from bokeh.models import CustomJS, ColumnDataSource from bokeh.plotting import Figure, output_notebook, show from bokeh.models.widgets import Select from bokeh.layouts import column output_notebook() x = [x*0.005 for x in range(0, 200)] y = x z = ['A' if i>50 else 'B' for i in range(len(x))] source = ColumnDataSource(data

how use bokeh vbar chart parameter with groupby object?

你离开我真会死。 提交于 2019-12-02 19:18:55
问题 Question Below code is grouped vbar chart example from bokeh documentation. There are something i can't understand on this example. Where 'cyl_mfr' is come from in factor_cmap() and vbar()? 'mpg_mean' , is it calculating the mean of 'mpg' column? if then, why 'mpg_sum' doesn't work? I want to make my own vbar chart like this example. Code from bokeh.io import show, output_file from bokeh.models import ColumnDataSource, HoverTool from bokeh.plotting import figure from bokeh.palettes import

how to show legend items of patches in bokeh

穿精又带淫゛_ 提交于 2019-12-02 18:37:52
问题 In the following set up, I create a area chart based on the basic example. How do I get the legend for my input automatically or even programatically. For now I get only legend with one item 'a' and the first color. from bokeh.plotting import * ... patches([x2 for a in areas], list(areas.values()), color=colors, alpha=0.8, line_color=None, legend='a', title="hello chart") legend().orientation = "top_right" # what other options, may here? show() What is the format to pass into patches for the

Embed an interactive Bokeh in django views

假装没事ソ 提交于 2019-12-02 17:41:46
I want to make interactive plot in django views (or model ?). Let's say I want to use selection_histogram example. I think Bokeh fit my needs because, I have matplot/seaborn that I can reuse and I'm not pretty good at javascript. There was no problem for me to follow this example : how to embed standalone bokeh graphs into django templates . As I understand, I need to run a bokeh server and make some proxy using nginx How can I embed a interactive bokeh plot into a django view ? I tried this : Launch bokeh server bokeh serve --allow-websocket-origin=127.0.0.1:8001 selection_histogram.py Update

Group by hours and plot in Bokeh

拜拜、爱过 提交于 2019-12-02 16:58:45
问题 I am trying to get a plot like a stock data in Bokeh like in the link http://docs.bokeh.org/en/latest/docs/gallery/stocks.html 2004-01-05,00:00:00,01:00:00,Mon,20504,792 2004-01-05,01:00:00,02:00:00,Mon,16553,783 2004-01-05,02:00:00,03:00:00,Mon,18944,790 2004-01-05,03:00:00,04:00:00,Mon,17534,750 2004-01-06,00:00:00,01:00:00,Tue,17262,747 2004-01-06,01:00:00,02:00:00,Tue,19072,777 2004-01-06,02:00:00,03:00:00,Tue,18275,785 I want to use column 2:startTime and 5:count and I want to group by

Chart on click selection from data table in Bokeh

梦想与她 提交于 2019-12-02 11:16:05
I've taken the below code from another source - it is not my own code. The code allows you to select a cell in the data table, and the 'downloads' data for that cell will chart based on the row of the cell selected. How do I expand this code such that if I have multiple variables (eg. 'downloads' and 'uploads') and so more columns in the data table, I can chart data based on that cell (so where row AND column are important)? Alternatively, how can I define as a variable the column number of a selected cell (in the same way selected_row below can be used to define the row number)? from datetime

Bokeh Widget Slicing data

时间秒杀一切 提交于 2019-12-02 11:04:15
I am trying to create a plot using bokeh to visualize my data on IPython Notebook. I want to add some widgets to make it more interactive. Below is an example of the codes. from bokeh.models import CustomJS, ColumnDataSource from bokeh.plotting import Figure, output_notebook, show from bokeh.models.widgets import Select from bokeh.layouts import column output_notebook() x = [x*0.005 for x in range(0, 200)] y = x z = ['A' if i>50 else 'B' for i in range(len(x))] source = ColumnDataSource(data=dict(x=x, y=y, z=z)) plot = Figure(plot_width=400, plot_height=400) plot.line('x', 'y', source=source,

Group by hours and plot in Bokeh

人盡茶涼 提交于 2019-12-02 10:07:07
I am trying to get a plot like a stock data in Bokeh like in the link http://bokeh.pydata.org/en/latest/docs/gallery/stocks.html 2004-01-05,00:00:00,01:00:00,Mon,20504,792 2004-01-05,01:00:00,02:00:00,Mon,16553,783 2004-01-05,02:00:00,03:00:00,Mon,18944,790 2004-01-05,03:00:00,04:00:00,Mon,17534,750 2004-01-06,00:00:00,01:00:00,Tue,17262,747 2004-01-06,01:00:00,02:00:00,Tue,19072,777 2004-01-06,02:00:00,03:00:00,Tue,18275,785 I want to use column 2:startTime and 5:count and I want to group by column day and sum the counts in respective hours. code: Does not give the output import numpy as np