bokeh

Nominal/categorical axis on a scatter plot

醉酒当歌 提交于 2019-12-22 15:51:21
问题 How is it possible to generate a nominal/categorical axis (entries like a, b, c instead of 1,2,3 ) on a scatter plot in Bokeh? Imagine that the following data should be plotted: a 0.5 b 10.0 c 5.0 I tried the following: import bokeh.plotting as bk # output to static HTML file bk.output_file("scatter.html", title="scatter plot example") x = ['a', 'b', 'c'] y = [0.5, 10.0, 5.0] p = bk.figure(title = "scatter") p.circle(x = x, y = y) bk.show(p) However, this generates an empty plot. If the x

Bokeh logarithmic scale for Bar chart

血红的双手。 提交于 2019-12-22 06:36:30
问题 I know that I can do logarithmic scales with bokeh using the plotting API: p = figure( tools="pan,box_zoom,reset,previewsave", y_axis_type="log", y_range=[0.001, 10**22], title="log axis example", x_axis_label='sections', y_axis_label='particles' ) However, I can't figure out how to get this to apply to high level charts such as Bokeh.charts.Bar. In general I'm having a lot of trouble grokking what to relationship is between a Chart and a figure . Can anyone point me to some documentation on

Get URL parameters for bokeh application

一笑奈何 提交于 2019-12-22 05:59:46
问题 Hi I am developing a bokeh application to perform some analysis. I want to get the URL parameters from the server so I can decide which data to render in the application. Currently I can route URLs like http://127.0.0.1:5006/bokeh/videos/?hello=1 with the following configuration, but is there a way I can get the GET parameters {'hello':'1'} from the application? @bokeh_app.route("/bokeh/analysis/") @object_page("analysis") def make_analysis(): app = AnalysisApp.create() return app 回答1: For

Filtering dataframe using Bokeh/Widget/Callback

拟墨画扇 提交于 2019-12-22 01:06:44
问题 Currently my data set is in the format: Date, Currency, Price which I am filtering at Currency level and then using it to generate graphs. I want to improve it so that all the filtering is done using Python widget/Dropdown boxes? I'm new to Python/Bokeh so I need some help. Date Currency Price 1/1/2017 AUDUSD 1.01 2/1/2017 AUDUSD 1.02 3/1/2017 AUDUSD 1.03 1/1/2017 USDJPY 1.01 2/1/2017 USDJPY 1.02 3/1/2017 USDJPY 1.03 1/1/2017 CADUSD 1.01 2/1/2017 CADUSD 1.02 3/1/2017 CADUSD 1.03 回答1:

How do I adjust number format in bokeh data table using HTMLTemplateFormatter?

不想你离开。 提交于 2019-12-21 23:42:05
问题 How do I adjust the number format of data in HTMLTamplateFormatter. I would like the number format to be "(0,0)". Here is sample code with the incorrect attempt: from bokeh.models import ColumnDataSource from bokeh.models.widgets import DataTable, TableColumn, HTMLTemplateFormatter, NumberFormatter from bokeh.io import show dict1 = {'x':[0]*6,'y':[500,1000,-1000,1000,-5000,500],'z':[0,0,1,1,1,2]} source = ColumnDataSource(data=dict1) template=""" <b><div style="background:<%= (function

Python, Bokeh: How to assign extra y-axis to line glyph in streaming plot?

送分小仙女□ 提交于 2019-12-21 06:57:24
问题 my problem can by simplified with a streaming plot of two lines and two y-axes. Each line is assigned to a different y-axis. With a Select Widget I would like to choose which line is assigned to the primary/secondary axis. This functionality is actually working in the code below. However, the axis assignment is only changed when the plot updates its data. I would like to have the axis assignment happen on change of the select widget. I tried a couple of 'update' functions, but none of them

Choosing order of bars in Bokeh bar chart

吃可爱长大的小学妹 提交于 2019-12-21 05:04:28
问题 As part of trying to learn to use Bokeh I am trying to make a simple bar chart. I am passing the labels in a certain order (days of the week) and Bokeh seems to be sorting them alphabetically. How can I have the bars show up in the order of the original list? from bokeh.plotting import show from bokeh.io import output_notebook from bokeh.charts import Bar from collections import OrderedDict import calendar output_notebook() data = OrderedDict() data['values'] = [2,3,4,5,6,7,8] #values only

How can I get data from a ColumnDataSource object which is synchronized with local variables of Bokeh's CustomJS function?

若如初见. 提交于 2019-12-21 02:41:43
问题 Based on the following code sample, I want to extract the data (for example the x value) in the CustomJS function to save it in the python list rect_data . Although the variable x is synchronized with the ColumnDataSource object source , the python list rect_data remains an empty list when I draw a rectangular selection in the figure of the executed code below. What am I doing wrong and how can I solve this problem? Thank you in advance! # You must first run "bokeh serve" to view this example

Embed an interactive Bokeh in django views

梦想与她 提交于 2019-12-20 09:03:32
问题 I want to make interactive plot in django views (or model ?). Let's say I want to use selection_histogram example. I think Bokeh fit my needs because, I have matplot/seaborn that I can reuse and I'm not pretty good at javascript. There was no problem for me to follow this example : how to embed standalone bokeh graphs into django templates. As I understand, I need to run a bokeh server and make some proxy using nginx How can I embed a interactive bokeh plot into a django view ? I tried this :

How can I make legend outside plot area with stacked bar

人盡茶涼 提交于 2019-12-20 07:12:52
问题 Hello, I have a problem with Bokeh library. I need make a legend box outside plot area. It works for circle and area plotting. I can't find the solution for the stacked bar.With the solution below the legend shapes one part of the graph, it isn't acceptable (see link under the code).I would like a legend in the box. Regards, SR import numpy as np from bokeh.layouts import gridplot from bokeh.models import ColumnDataSource, NumeralTickFormatter,LinearAxis, Range1d, Legend from bokeh.plotting