bokeh

How to refresh Bokeh Document

北城以北 提交于 2019-12-04 11:50:35
问题 I would like to refresh a bokeh document so I can replace old plots with new ones. However, right now I just get the new plots appended to the document so the old ones don't go away. #myfile.py from bokeh.plotting import curdoc, figure doc = curdoc() p1 = figure(width=1500, height=230, active_scroll="wheel_zoom") doc.add_root(p1) doc.clear() p2 = figure(width=1500, height=500, active_scroll="wheel_zoom") doc.add_root(p2) This results in the second plot being displayed after the first plot,

How to set properties of selected/unselected glyphs in bokeh

末鹿安然 提交于 2019-12-04 07:01:53
I have a dataset consisting of timeseries of a few observables, and I'd like to use bokeh to look at the phase diagram at different points in the time series. What I want to know is how to change the properties of the selected or unselected glyphs (in this case I'd like to reduce the alpha of the unselected points or change the color of the selected ones). The code below creates the interface I want in an ipython notebook, and is based on the example in the users guide http://bokeh.pydata.org/en/0.10.0/docs/user_guide/interaction.html#linked-brushing . I can't find any obvious options to set

Efficient updates of image plots in Bokeh for interactive visualization

Deadly 提交于 2019-12-04 05:21:28
I'm trying to create a smooth interactive visualization of different slices of a muldimensional array using Bokeh. The data in the slices changes according to the user interaction and thus has to be updated several times per second. I have written a Bokeh app with several small image plots (64x64 values) to show the contents of the slices, and a callback to update the ColumnDataSources when the user interacts with the app. Everything works as expected but I can't get more than 2 or 3 frames per second and I would like to get at least 10 frames. Here is a simplified sample of my code using 16

Unable to clear multi-line figure with callback

走远了吗. 提交于 2019-12-04 05:12:24
问题 I have a figure with a line plot and another one with a multi-line plot. The plot updates when a user selects a new option from a Select object. The line plot updates correctly as is syncd with a ColumnDataSource. However, the multi-line plot pulls the info from a pandas dataframe. The problem is that the lines accumulate on the multi-line plot every time I select a new option. I tried to use this within the on_change callback function but won't work: select.js_on_change('value',CustomJS(args

Bokeh's equivalent to matplotlib subplots

耗尽温柔 提交于 2019-12-04 04:28:20
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. 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_notebook() # a random dataset data = bk_models.ColumnDataSource(data=dict(x=np.arange(10), y1=np.random.randn(10),

python bokeh plot how to format axis display

江枫思渺然 提交于 2019-12-04 04:11:56
the y axis ticks seem to be formatting numbers like 500000000 to 5.000e+8. Is there a way to control the display so that it displays as 500000000? using python 2.7, bokeh 0.5.2 i m trying out the timeseries example at bokeh tutorials page The tutorial plots 'Adj Close' against 'Date' but i'm plotting with 'Volume' against 'Date' sharon You can also use NumeralTickFormatter as used in the toy plot below. The other possible values in place of '00' are listed here . import pandas as pd import numpy as np from bokeh.plotting import figure, output_file, show from bokeh.models import

can't perform this operation for unregistered loader type

删除回忆录丶 提交于 2019-12-04 03:37:52
问题 I'm using bokeh for data visualization, and trying to make an executable but it shows an error message of "can't perform this operation for unregistered loader type" I have tried as a solution of init .py to the directory (+subdir) of my script.py, but it's not work. PS. Win10, Python 3.6.3, pyinstaller 3.4, bokeh 0.12.13 Code: from bokeh.plotting import figure, show p = figure(width=800, height=400, title="Money") p.title.text_color = "green" p.title.text_font_size = "18pt" p.xaxis.axis

Bokeh: DataTable - how to set selected rows

十年热恋 提交于 2019-12-04 02:28:50
I would like to change the DataTable object row selection programmatically (without JS, just python). I have tried to so using the selected property of the underlying ColumnsSource with no success. How can this be done? See an example app (needs bokeh serve to run) where pressing the button changes the selected rows, then updates both a table and plot. Is this all the functionality you need? By the way you could just do it in JS and not need to use bokeh server, but if you have more python functionality going on then i guess you need it. from datetime import date from random import randint

Bokeh server - How to manipulate a selection in a callback function

前提是你 提交于 2019-12-04 01:42:48
问题 I am plotting several patches that are grouped by a category "group" in the data source. What would I like to achieve is the following: By clicking on one patch, not only the patch itself but all patches of the same group should be highlighted as selected. I found that ColumnDataSource has an attribute selected . However, manipulating this attribute in the callback function does not have the desired effect. import os from bokeh.models import ColumnDataSource, Patches from bokeh.plotting

Python, Bokeh: How to assign extra y-axis to line glyph in streaming plot?

↘锁芯ラ 提交于 2019-12-03 21:36:46
my problem can by simplified with a streaming plot of two lines and two y-axes. Each line is assigned to a different y-axis. With a Select Widget I would like to choose which line is assigned to the primary/secondary axis. This functionality is actually working in the code below. However, the axis assignment is only changed when the plot updates its data. I would like to have the axis assignment happen on change of the select widget. I tried a couple of 'update' functions, but none of them work. I'm assuming that the 'stream' function updates the axis assignment. How, could this be done on