bokeh

Bokeh EditTools callback to server

久未见 提交于 2019-12-11 19:53:30
问题 I am trying to understand how to use callbacks for the new Bokeh EditTools (e.g. BoxEditTool or similar). Specifically, I would like to see on the server side the coordinates of the newly added rectangles, but I am not sure how to do this. I am running the following server app def app( curdoc ): TOOLS = "tap" p = figure(title="Some Figure", tools=TOOLS) source = ColumnDataSource( {'xs':[1], 'ys':[1], 'width':[.1],'height':[.1]}) r = p.rect('xs','ys','width','height', source=source) p.add

Bokeh Area Chart unable to plot

China☆狼群 提交于 2019-12-11 17:53:01
问题 I am unable to plot the area chart in bokeh for some reason.. Below is the code used for the same.. from bokeh.charts import Area, show, output_file Areadict = dict( I = df['IEXT'], Date=df['Month'], O = df['OT'] ) area = Area(Areadict, x='Date', y=['I','O'], title="Area Chart", legend="top_left", xlabel='time', ylabel='memory') output_file('area.html') show(area) All i see if the date axis getting plotted, but no signs of the two areacharts that I am interested in. Please advise 回答1: I would

python bokeh legend out of the plot size

有些话、适合烂在心里 提交于 2019-12-11 17:47:35
问题 I'm new in python, and somebody help me with this code, but I want to change some parameter: First the size of the legend out of the plot, some time the legend are to big (example: D_0__Bacteria;D_1__Firmicutes;D_2__Clostridia;D_3__Clostridiales;D_4__Peptostreptococcaceae;D_5__Acetoanaerobium), and some time it is short (Acetoanaerobium), so I just want to make the legend auto fix the size (in the figure the legend are not complete)!!!. Second, the label that appear when the pointer get hover

Bokeh interactive dashboard can not remove lines from plot

本秂侑毒 提交于 2019-12-11 17:29:46
问题 I am working on my first python Bokeh interactive dashboard. Plot default shows lines for group=a and group=b. When check box[1], plot will add lines for group=a1 and group=b1. When uncheck [1], line a1, b1 are supposed to be removed from plot, but they still stay in the plot. Below is my sample data and sample code. It can directly run in your jupyter notebook. Can any one help me out? Thank you very much! import pandas as pd import numpy as np import matplotlib.pylab as plt from bokeh.io

Smaller range padding for image plot with bokeh

两盒软妹~` 提交于 2019-12-11 16:31:12
问题 I'm using bokeh 1.0.4 and I would like to generate an image plot in bokeh using match_aspect=True . Here is a example code for illustration: from bokeh.models.ranges import DataRange1d from bokeh.plotting import figure, show import numpy as np arr = np.array([[1,2,3],[4,5,6]]) plot = figure(match_aspect=True) plot.image([arr], x=0, y=0, dw=3, dh=2) show(plot) This is what I get: There is a lot empty space around the data, too much for my application, and I would like to have the axes more

How to update a source in a JavaScript Callback of Bokeh in Python?

我与影子孤独终老i 提交于 2019-12-11 16:13:11
问题 I am adapting this answer for my case, where I want an interactive, standalone graph where the slider selects which column of the data to plot in a bar chart. (Standalone is crucial, I cannot run a Bokeh server, thus the need for JavaScript callbacks.) The data is a rectangle of floats with 100 rows in each of the 38 columns, which all have string labels like '40' etc. (This is how pandas .read_csv() handles numerics in the header by default.) Here is a sample from the top left corner (3x3,

Bokeh resize plot dynamically

ⅰ亾dé卋堺 提交于 2019-12-11 15:50:02
问题 i have Bokeh 0.12.6, what i do p2 = figure(x_axis_type="datetime", plot_width=1500,plot_height=700, x_range=p1.x_range, title="") select = Select(title="SELECT", options=["val1", "val2", "val3"]) select.callback = CustomJS(args={'plot1': p1, 'plot2': p2}, code=""" if(cb_obj.value === "val1"){ plot2.width = 1500; }else{ plot2.width = 700; } plot2.document.resize(); """) I need to resize plot by clicking dropdown but i recieve js error that document.resize is not a function. Also i tried plot2

bokeh server- rejected connection because host is not in whitelist

天大地大妈咪最大 提交于 2019-12-11 15:32:16
问题 I am trying to run a simple bokeh server script on my local machine: #app.py from bokeh.io import curdoc from bokeh.models import ColumnDataSource from bokeh.plotting import figure from random import randrange #create figure f=figure(x_range=(0,11),y_range=(0,11)) #create columndatasource source=ColumnDataSource(data=dict(x=[],y=[])) #create glyphs f.circle(x='x',y='y',size=8,fill_color='olive',line_color='yellow',source=source) #create periodic function def update(): new_data=dict(x=

Replacing figure and table in layout when using global ColumnDataSource

﹥>﹥吖頭↗ 提交于 2019-12-11 15:29:22
问题 I am using bokeh 0.12.9. I have a table and a figure which I replace in the global layout on callback. I usually build the ColumnDataSource right before I build the new figure/table. Now I wanted to try and see if I can have a global ColumnDataSource so that I can adjust the data via a CDSView (no need to replace table/figure then). Unfortunately even keeping a separate CDS and view for table and plot fails. When clicking the radio button a couple of times I receive the following javascript

Having “broken” y-axis in Bokeh plot/figure

烈酒焚心 提交于 2019-12-11 15:27:24
问题 Is there a way to have a "broken" y-axis in a Bokeh figure/plot, so that values that stand out too much will not ruin the entire plot? In my case I am using vbar , but guess this has to do with the figure object. E.g. Thanks! 回答1: As of version 0.12.14 there is no built-in broken axis capability in Bokeh. It might be possible to implement custom extension mapper and axis models for this, but it would not be trivial to do. To propose adding this functionality to Bokeh directly, make a Github