bokeh

Bokeh widget callback to select all checkboxes

我只是一个虾纸丫 提交于 2019-12-07 18:08:37
问题 I have run into a couple problems in trying to setup a Bokeh CheckboxGroup widget. The Checkbox group it self is large (50 states) and I would like to initialize the selection as all active. Also (and more importantly) since this group is intended to be highly interactive, I would like to add buttons to "Select All" and "Clear All". I understand that I will need some callback mechanism to do this, but after searching the examples, documentation and stackoverflow, was not able to figure out

Bokeh FixedTicker with Custom Datetime/Timestamp values

限于喜欢 提交于 2019-12-07 17:40:42
问题 Objective: I want to have tick marks on the x axis only on 2017/10/2 and 2017/10/5. One constraint is that my times are not guaranteed to be evenly separated, so converting to a string and doing a categorical axis is not possible. They need to be numeric/datetime. Problem: I'm unsure how to properly format the desired dates so they are rendered properly by Bokeh. I've tried dividing by 10 ** 9 and such to convert to milliseconds. This has not worked. Sample Code: from bokeh.plotting import

Deselect Bokeh tools by default

霸气de小男生 提交于 2019-12-07 16:14:04
问题 When Bokeh tools are available, one is always selected by default (normally "pan"). Is there a way to have all tools be deselected while still making them available? This way the reader is less likely to mess up the plot by accident, especially on a small mobile device. 回答1: As of Bokeh 0.12 or so, it is possible to configure which tools are active: # configure so that no drag tools are active plot.toolbar.active_drag = None # configure so that Bokeh chooses what (if any) scroll tool is

Bokeh Multi-Select widget callback not Working

為{幸葍}努か 提交于 2019-12-07 12:44:29
问题 I am new to Bokeh. Trying to implement few widget callbacks recently and hard to find any resources online. Scenario: I have a multi_select bokeh widget with the list of the companies. Based on the companies selcted, data in the Vbar has to be changed. For this, i am trying to change the datasource that is used in the Vbar based on the values from Multi select. I am unable to get desired results. Can someone please help me out with this. I am poor at CustomJs and hence doing this on Bokeh

Using months in x axis in bokeh

梦想的初衷 提交于 2019-12-07 09:13:28
问题 Lets say I have the following data: import random import pandas as pd numbers = random.sample(range(1,50), 12) d = {'month': range(1,13),'values':numbers} df = pd.DataFrame(d) I am using bokeh to visualize the results: p = figure(plot_width=400, plot_height=400) p.line(df['month'], df['values'], line_width=2) output_file('test.html') show(p) The results are ok. What I want is the x axis to represent a month(1:January,2:February..). I am doing the following to convert the numbers to months:

Bokeh: pass vars to CustomJS for Widgets

戏子无情 提交于 2019-12-07 05:30:30
问题 A nice thing about Bokeh is that callbacks can be specified from the Python layer that result actions on the javascript level without the need of bokeh-server. So one can create interactive widgets that run in a browser without an Ipython or Bokeh server running. The 0.9.3. documentation gives an example that I can reproduce in an ipython notebook: http://docs.bokeh.org/en/latest/docs/user_guide/interaction.html#cutomjs-for-widgets from bokeh.io import vform from bokeh.models import CustomJS,

Bokeh: AttributeError: 'DataFrame' object has no attribute 'tolist'

爱⌒轻易说出口 提交于 2019-12-07 04:14:08
问题 I am new to pandas and bokeh and I am trying to create a scatter plot from a pandas dataframe. However, I keep getting the following error: new_data[colname] = df[colname].tolist() AttributeError: 'DataFrame' object has no attribute 'tolist' Using the dummy data from bokeh (from bokeh.sampledata.iris import flowers as data) the scatter works fine. type tsneX tsneY +50.000 columns 0 A 53.828863 20.740931 1 B 57.816909 18.478468 2 A 55.913429 22.948167 3 C 56.603005 15.738954 scatter = Scatter

python bokeh; change Patch colours with CustomJS callback on GMapPlot

六月ゝ 毕业季﹏ 提交于 2019-12-07 03:26:25
I'm trying to add a button to my bokeh plot that will allow me to change the colour used on a patch glyph that I've added to a GMapPlot using a callback. Currently what I have is: from bokeh.io import output_file, show from bokeh.models import GMapPlot, GMapOptions, ColumnDataSource, DataRange1d, Patch map_options = GMapOptions(lat=-41.281909, lng=174.775993, zoom=13) p = GMapPlot(x_range=DataRange1d(), y_range=DataRange1d(), map_options=map_options, api_key=API_KEY) lats = [-41.281909, -41.281044, -41.294968] longs = [174.775993, 174.761222, 174.764916] source = ColumnDataSource(data=dict

Bokeh heatmap usage

試著忘記壹切 提交于 2019-12-07 03:04:06
问题 I have an array of certain events with time stamp and want to create a heatmap: x axis should represent the date, f.e. '2016-02-03', y axis should represent the hour of occurrence, f.e. 13 (if 13:32), the color should depend on the count of occurred event. My data (as pandas dataframe z.head() ): date hour i 0 2016-01-15 13 1 1 2016-01-15 13 1 2 2016-01-15 12 1 3 2016-01-15 10 1 4 2016-01-15 10 1 My failed attempt: from bokeh._legacy_charts import HeatMap, output_file, show hm = HeatMap(z

Bokeh add label to second axis on the right

╄→尐↘猪︶ㄣ 提交于 2019-12-07 01:27:47
问题 I am creating a bar chart using Bokeh, and I want to display 2 independent sets of data. I have added another y-axis to the right side of my plot using the following bar2.extra_y_ranges = {"Mtons": Range1d(start=0, end=2000)} bar2.add_layout(LinearAxis(y_range_name="Mtons"), 'right') How do I add a label for the second axis? 回答1: LinearAxis has a parameter axis_label. This can be set by editing the call to LinearAxis as follows: bar2.add_layout(LinearAxis(y_range_name="Mtons", axis_label="Mt