bokeh

Bokeh FixedTicker with Custom Datetime/Timestamp values

烂漫一生 提交于 2019-12-06 00:18:56
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 figure, show from bokeh.models import FixedTicker import pandas as pd import numpy as np y = list(range(3

python bokeh plot how to format axis display

最后都变了- 提交于 2019-12-06 00:09:40
问题 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' 回答1: 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

Deselect Bokeh tools by default

早过忘川 提交于 2019-12-05 19:59:09
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. 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 active plot.toolbar.active_scroll = "auto" # configure so that a specific PolySelect tap tool is active plot

Bokeh: Automatically refreshing bokeh plots

杀马特。学长 韩版系。学妹 提交于 2019-12-05 19:23:53
问题 I'm trying out an example Bokeh Application (in 'single module format') for generating a chart from a dataset. In the given example, the user on the web page can click on a button and the chart will update with the latest data. I am trying to figure out how I can achieve this same behavior without requiring the user to click on the button. That is, I would like the chart to automatically update/refresh/reload at a specified interval without the need for user interaction. Ideally, I would only

Bokeh: DataTable - how to set selected rows

自闭症网瘾萝莉.ら 提交于 2019-12-05 16:55:40
问题 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? 回答1: 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

Bokeh: pass vars to CustomJS for Widgets

倖福魔咒の 提交于 2019-12-05 11:43:34
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, ColumnDataSource, Slider from bokeh.plotting import figure, output_file, show output_file("callback

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

谁说胖子不能爱 提交于 2019-12-05 11:33:04
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(df, x='tsneX', y='tsneY', color='type', marker='type', title='t-sne', legend=True) Edit: I'm not using

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

情到浓时终转凉″ 提交于 2019-12-05 11:15:29
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 interactivity is not required for this. Bokeh has functionality to create PNG files via the browser so it is

Bokeh heatmap usage

╄→гoц情女王★ 提交于 2019-12-05 07:58:33
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.head(), x='date', y='hour', values='i', stat='count') And the exception: AttributeError Traceback (most

How to use a slider callback to filter a ColumnDataSource in Bokeh using Python 3?

北战南征 提交于 2019-12-05 07:35:03
问题 I'm trying to use a slider with a callback in Bokeh using Python 3 to filter the rows of my ColumnDataSource objects (which originate from a DataFrame). More specifically, if a slider with options of 0 to 10000000 (in multiples of 1 million) returns a value N of say 2000000, then I want my plot to only show the data for, in this case, US counties where the population is >= 2000000. Below is my code. Everything works as I want it to except for the slider callback. from bokeh.io import curdoc