bokeh

How to replace curdoc

筅森魡賤 提交于 2019-12-11 15:18:25
问题 How can I replace the current document in a bokeh server app? I have a previous document saved as a json_string . If I do set_curdoc(Document.from_json_string(json_string)) this seems to properly change curdoc(), however the new document is not displayed in the browser. 回答1: I found a workaround, other places suggest to update the children of an existing layout instead of updating the whole curdoc(). I did that but I had to expand a bit to do that from a document saved in a json string. I had

Heatmap does not show

醉酒当歌 提交于 2019-12-11 14:23:21
问题 I am trying to plot a simple heatmap from a dataframe that looks like this: row column content amount 0 x a c1 1 2 x b c3 3 4 x c c2 1 6 y a c1 1 8 y b c3 3 10 y c c2 1 12 z a c1 1 14 z b c3 3 16 z c c2 1 row and column indicate the position of the cell, the color of it should be chosen based on content and I want tooltips displaying the content and the amount . I currently try it like this (using bokeh 1.2.0): import pandas as pd from bokeh.io import show from bokeh.models import

Bokeh web server app at localhost to html file

有些话、适合烂在心里 提交于 2019-12-11 13:15:48
问题 I have been working with bokeh web server . I created a web app, using my own data and following this example: https://github.com/bokeh/bokeh/blob/master/examples/app/movies/main.py I already finished the script and everything went ok. I can see the result using this command: bokeh serve --show main.py The modules I used to create the web app were: from os.path import dirname, join from pandas import Series, DataFrame from bokeh.plotting import figure from bokeh.layouts import layout,

bokeh 0.12.10 not rendering Segments on GMapPlot

╄→гoц情女王★ 提交于 2019-12-11 12:35:14
问题 I am trying to display line segments on a map using GMapPlot. The lines flashes in red and then disappears, in jupyter notebook. This is my code (some decimals left out): map_options = GMapOptions(lat=37.88, lng=-122.23, map_type="roadmap", zoom=10) plot = GMapPlot( x_range=DataRange1d(), y_range=DataRange1d(), map_options=map_options ) source = ColumnDataSource( data = dict( y=[ 37.762260 ], x=[-121.96226], ym01=[37.762290 ], xm01=[-121.96189 ] ) segment = Segment(x0="x", y0="y", x1="xm01",

Bokeh: Display user input text

走远了吗. 提交于 2019-12-11 10:28:00
问题 I am trying to figure out how to display a user's input with Bokeh. Sample code is below. Any pointers would be greatly appreciated. Thank you from bokeh.layouts import widgetbox from bokeh.models import CustomJS, TextInput, Paragraph from bokeh.plotting import output_file, show # SAVE output_file('Sample_Application.html',mode='inline',root_dir=None) # PREP DATA welcome_message = 'You have selected: (none)' # CALLBACKS def callback_print(source=None, window=None): user_input = str(cb_obj

Bokeh Hovertool for patch

≡放荡痞女 提交于 2019-12-11 09:46:10
问题 Is the hover tool for patch different than other glyphs? The plot can see the index for circle but not for patch. output_file("patch.html") TOOLTIPS = [ ("index", "$index"), ] p = figure(plot_width=400, plot_height=400, tooltips=TOOLTIPS, tools='hover,help') # add a patch renderer with an alpha an line width p.patch([1, 2, 3, 4, 5], [6, 7, 8, 7, 3], alpha=0.5, line_width=2) p.circle([2], [4],size=20, line_width=2) show(p) 回答1: As of Bokeh 1.0.2, hit testing has not been implemented for Patch,

Reverse axis in python bokeh

淺唱寂寞╮ 提交于 2019-12-11 07:33:58
问题 I am trying to reverse the y axis and set range for both x and y in a Bokeh scatter plot. I am using: BokehPlot.bokeh_scatter(data=df, x_range=(min_utc, max_utc), y_range=(min_val, max_val)) I get an error: TypeError: bokeh_scatter() got an unexpected keyword argument 'x_range' Any idea how axes can be reversed in a Bokeh scatterplot with a pandas dataframe input 回答1: The following will flip the y-axis for a scatter plot. p = figure() xmin = data[xval].min() xmax = data[xval].max() ymin =

How do I achieve consistent appearance in different backends in HoloViews?

蹲街弑〆低调 提交于 2019-12-11 07:27:50
问题 I'm mystified by how to use HoloViews styles to customize plots and achieve a consistent appearance across backends. HoloViews is billed as a package that provides an abstraction layer to several backends, notably Bokeh and Matplotlib, but I'm completely failing in my attempts to get plots generated using these backends to look the same. Settings in one backend are ignored by another, and each backend has many (most) formatting options missing, so that it is necessary to break through the

how to link vbar with circle plots using bokeh?

自古美人都是妖i 提交于 2019-12-11 06:59:46
问题 I have three plots based on the same dataset. How can I link all three plots so that when I select a certain species in vbar plot, two scatter plot also change to plot points in that species only. any help is appreciated~ from bokeh.sampledata.iris import flowers from bokeh.plotting import figure, output_file, show from bokeh.models import ColumnDataSource, CategoricalColorMapper from bokeh.layouts import column, row #color mapper to color data by species mapper = CategoricalColorMapper

Python Bokeh: How to update a Toggle button - defined in the main - in a subroutine

佐手、 提交于 2019-12-11 06:49:05
问题 I have the following simple bokeh example. The start button starts an infinitive while loop in a subroutine, which should stop running as soon as button 3 is pressed or the checkbox is unchecked. Button2 checks the status without the loop which works fine. As button3 and the checkbox cb are defined in the main the subroutine called by button1 does not recognize the change. Is there a way to solve this? I used bokeh version 1.0.1. You can run the example lokally with bokeh serve script.py and