bokeh

How to get Bokeh DataTable cell content on click?

 ̄綄美尐妖づ 提交于 2019-12-14 02:10:07
问题 Do you know how to get Bokeh DataTable cell value by clicking on it? If I use: data = dict( items=bokehItems, values0=bokehValues0, values1=bokehValues1, values2=bokehValues2 ) source = ColumnDataSource(data) columns = [ TableColumn(field="items", title="Item"), TableColumn(field="values0", title="Value"), TableColumn(field="values1", title="Cluster"), TableColumn(field="values2", title="Interaction"), ] data_table_worst_cases = DataTable(source=source, columns=columns, height=280, row

Python open html file, take screenshot, crop and save as image

随声附和 提交于 2019-12-14 00:32:20
问题 I am using the Bokeh package to generate maps to show the results of a simulation. The output is individual maps in html format with interactivity. The interactivity is needed for individual maps. See this link for an example: http://docs.bokeh.org/en/0.10.0/docs/gallery/texas.html The simulation can automatically be set to run a number of times and will produce a map for each run. This could be 100's of maps. I would like to be able to stitch together the maps to create a movie - the

How to embed a bokeh server in a standalone

前提是你 提交于 2019-12-13 17:56:15
问题 I'm trying to embed a bokeh server in a standalone document as presented here. I'm quite lost and couldn't wrap my head around the example provided. I tried to implement it in the following example, but when I run it doesn't show the application. Could someone show me how to create this standalone? Thanks from bokeh.io import show, curdoc from bokeh.models import ColumnDataSource, Legend, CustomJS, Select from bokeh.plotting import figure from bokeh.palettes import Category10 from bokeh

Bokeh and Joblib don't play together

佐手、 提交于 2019-12-13 17:30:22
问题 I have a Bokeh script which calls the data using a function wrapped with joblib's @memory.cache decorator. When I run the script as a python script the get_data function is fast (cached). When I call it using bokeh server --show code.py it seems like cache is lost and the function is re-evaluated, making data retrieval slow. How can I make Bokeh work nicely with Joblib? 回答1: It's hard to say for certain without being able to run an example that reproduces what you are seeing. But my guess is

Insert a newline character into a categorical axis factor label in BokehJS

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 16:50:42
问题 I have a BokehJS plot with a categorical x-axis with factors that have strings that are very long. The label is being cut off by the edge of the graph and I would like to be able to insert a newline character either manually or automatically to produce a short length string (since it is now taller but narrower with a new line in the middle). I have tried the following code but it does not seem to create a change in the appearance. p.x_range.attributes['factors'][0] = 'Some very long text

Link a Span or Cursor in between plots with Bokeh in Python

纵然是瞬间 提交于 2019-12-13 16:23:05
问题 I would like a cursor that is linked between to plots in Bokeh. So if I move my cursor on one plot, an equivalent line shows up on an adjacent plot. I haven't figured out how to do it with the built in cursor tool. So my current solution is to draw a line on each plot that shares a source. Then when I hover over either plot, the source is updated. I have 2 issues with this method: 1. It seems like a workaround 2. Currently the lines are finite length. I would like the line to be infinite, so

Bokeh Div Text Size

你离开我真会死。 提交于 2019-12-13 15:16:34
问题 How do I change the text size inside a single bokeh Div widget without changing the text size of other Divs in my app? (https://docs.bokeh.org/en/latest/docs/reference/models/widgets.markups.html) 回答1: Div takes a style argument in which you can put a dictionary filled with normal html styling, eg: some_div = Div(text="<b>A Title</b>", style={'font-size': '200%', 'color': 'blue'}) 回答2: In case of use of a bokeh server, you can also use css_classes = [] to add CSS class with definition in your

Bokeh Multi-line with hover

你离开我真会死。 提交于 2019-12-13 09:36:29
问题 I have pandas dataframe which looks like this 'A' 'B' 'C' 2018/1/1 10 20 20 2018/1/2 34 13 23 2018/1/3 23 45 43 2018/1/4 14 98 76 2018/1/5 58 65 57 How do I convert this to columnDataSource ? How do I create a multi-line graph in bokeh with hover tool. X-axis as the date 回答1: Imports: import pandas as pd from bokeh.models import ColumnDataSource, HoverTool from bokeh.plotting import figure, show, output_notebook output_notebook() Here's the data as you present it: days = ['2018/1/1', '2018/1

How to change the extent and position of an existing image in bokeh?

匆匆过客 提交于 2019-12-13 07:37:23
问题 I am displaying 2d data as images of varying shapes in a bokeh server, and therefore need to dynamically update not only the image's data source, but also its dw , dh , x , and y properties. In the dummy example below, these changes are made in a callback function which is connected to a Button widget. I've figured out that I need to access the glyph attribute of the image's GlyphRenderer object, and I can do so through its update() method (see code). But the changes don't take effect until I

Displaying Bokeh Crossfilter Example

时光怂恿深爱的人放手 提交于 2019-12-13 07:24:59
问题 I dowloaded the repository for Bokeh Crossfilter example from here: https://github.com/bokeh/bokeh/tree/master/examples/app/crossfilter It is supposed to generate the interactive plot displayed here: https://demo.bokeh.org/crossfilter I ran main.py in the repository. However, nothing appeared. Then I realized the code does not show the layout. So I added the line show(layout) in the end, which did indeed display the layout on a web browser but it would not update the plot when I select