bokeh

Bokeh 0.7.1: Dynamically Add Plot to Bokeh-Server Generated Existing Page

痞子三分冷 提交于 2019-12-11 02:22:01
问题 I'm using bokeh-server to handle data streaming via tcp to plots that I currently have displaying to browser using output_server. I'd like to be able to dynamically add more plots to the current browser page, as the data comes through on the socket. Part of my trouble is that I don't fully understand how cursession() and curdoc() work/how they are different. My current code looks like this: plots = [] if create_new_plot: plots.append(create_new_plot_def()) if open_new_tab: show(plots) open

Why is the plotting order not respected when I plot a Circle and a Multiline later?

人盡茶涼 提交于 2019-12-11 02:03:53
问题 I am plotting some circles with blue color with one ColumnDataSource On the order hand, once the circles are plotted, I plot a Multiline glyph as well. I use another source for this glyph. The glyphs are plotted correctly but they do not respect the order I have plotted them. I want to plot the Multiline on the top of the figure to make it always visible. from bokeh.plotting import figure from bokeh.models.sources import ColumnDataSource, CDSView from bokeh.models.filters import IndexFilter

Bokeh: The widths of vertical bars doesn't change

一世执手 提交于 2019-12-11 01:38:43
问题 I came across one problem I couldn't find a solution. I would like to change the bar width of my plot, but doesn't matter the number I put in the WIDTH parameter of the method vbar, the graph remains the same. The plot with WIDTH=100 The plot with WIDTH=500 Apply Zoom is not a solution. The bar seems like a line Here is the code: from bokeh.io import show, output_file from bokeh.plotting import figure import pandas as pd df = pd.read_csv('Data/moviments.txt', delimiter='\t', encoding='utf-8')

Bokeh custom ToolTips {safe} tag displays nothing

a 夏天 提交于 2019-12-11 00:57:39
问题 When running the following Bokeh code, using the latest Bokeh and py35, the @fonts{safe} does not show up at all in the ToolTip. However when {safe} is deleted @fonts appears (not rendered of course). Does anyone know what I can do to make {safe} work? Or is there another way that I could make HTML render in ToolTips? from bokeh.plotting import figure, output_file, show, ColumnDataSource from bokeh.models import HoverTool output_file("toolbar.html") source = ColumnDataSource( data=dict( x=[1,

Bokeh multi_line and HoverTool

谁都会走 提交于 2019-12-11 00:47:14
问题 In Bokeh 0.10.0 we can use HoverTool for lines. But can we use it for multi_line? For example, when running the following code, from bokeh.models import ColumnDataSource from bokeh.models import HoverTool from bokeh.plotting import figure, output_file, show x = [1, 2, 3, 4, 5] ys = [[6, 7, 2, 4, 5], [5, 4, 2, 7, 6]] hover = HoverTool( tooltips=[ ("(x,y)", "($x, $y)"), ("label", "@label"), ] ) output_file("test_bokeh.html", title="bokeh feature test") p = figure(title='figure', x_axis_label='x

Bokeh gridplot: define different heights for figures with sizing_mode='stretch_both'

北城以北 提交于 2019-12-11 00:42:25
问题 Is it possible to define different heights for individual figures in a Bokeh gridplot layout ( bokeh==1.0.4 )? For example, I have three figures with three different heights: p1 = figure( name="fig1", width=500, height=500, ) p2 = figure( name="fig2", width=500, height=1000, ) p1 = figure( name="fig3", width=500, height=100, ) I then place the figures into a gridplot and add the root to curdoc() : grid = gridplot( children = [p1,p2,p3], ncols=1, sizing_mode='stretch_both', ) curdoc().add_root

Replot on Bokeh Google Map Offline

China☆狼群 提交于 2019-12-10 23:52:18
问题 I would like to create a bokeh gmap figure with some plotted circles, save that figure's map background, and then create offline figures with new circles on that same map background. For example: import bokeh.plotting as bk from bokeh.models import GMapOptions from bokeh.io import output_file, show, save output_file('test.html', , mode='inline') api_key = #insert your key here mid_lat = 39.8283 mid_lon = 98.5795 map_options = GMapOptions(lat = mid_lat, lng = mid_lon, map_type="satellite",

Grouped X-axis Variability plot in Python

为君一笑 提交于 2019-12-10 23:45:35
问题 I have a dataset as below. I would like to plot a variability plot like in JMP with Grouped X-axis with multiple categories and legend by row. Example of dataset and Plot from JMP are below. Is there a Pythonic solution to plotting this type of data? I am looking for a solution using any of the python plotting libraries - bokeh,matplotlib,seaborn etc., Sample Data JMP Var plot Example 回答1: You can try this code, you'll need to modify the xlim and ylim parameters of plot to fit your real data:

setting figure ranges using TapTool in bokeh

☆樱花仙子☆ 提交于 2019-12-10 21:45:08
问题 In the below example I have 2 scatter plots on top of each other. The intended behaviour is: when clicking a point in the upper graph, the lower one zooms in to the surrounding region when clicking a point in the lower graph, the lower plot zooms in to the surrounding region I've got the first behaviour to run, but the second one doesn't seem to work: the x_range gets reset to cover the whole span of the data, ignoring the xrange.start= assignment in the callback. # test_data_a is a pandas

Adding widgets dynamically in bokeh

∥☆過路亽.° 提交于 2019-12-10 20:26:37
问题 I want to add filters dynamically in bokeh, i.e. every time a button is pressed, a new filter is appended. However, the layout gets broken after a new widgets are added: new ones get written over old ones instead of the layout being recomputed. Code example from bokeh.layouts import row, column from bokeh.models.widgets import Button, Select from bokeh.io import curdoc def add_select(): feature = Select(value='feat', options=["a"]) dynamic_col.children.append(feature) b1 = Button(label="Add