bokeh

Can we specify bokeh exported png file size / resolution?

蹲街弑〆低调 提交于 2019-12-02 04:45:22
With Python Bokeh export_png function, we can export an object to png file. However, I cannot find any way to specify the resulted png file size / resolution. I found that I used the same code and got different png files in Windows and Linux. In Windows, the resolution is much lower. I understand we can use export_svgs() to have better figure file. But compared with export_png() , export_svgs() has many limitations. We cannot use export_svgs() on div, column or row objects. In recent enough versions, export_png accepts width and height parameters: https://bokeh.pydata.org/en/latest/docs

Unable to clear multi-line figure with callback

我只是一个虾纸丫 提交于 2019-12-02 04:29:55
I have a figure with a line plot and another one with a multi-line plot. The plot updates when a user selects a new option from a Select object. The line plot updates correctly as is syncd with a ColumnDataSource. However, the multi-line plot pulls the info from a pandas dataframe. The problem is that the lines accumulate on the multi-line plot every time I select a new option. I tried to use this within the on_change callback function but won't work: select.js_on_change('value',CustomJS(args=dict(plot=plot), code="""plot.reset.emit()""")) I actually should include the CustomJS within my

Unable to run bokehjs code because bokehjs library is missing

橙三吉。 提交于 2019-12-02 03:47:10
Id like to embed a graph with bokeh, but I get a page with the unrendered graph on it. home.html <link rel="stylesheet" type="text/css" href="http://cdn.pydata.org/bokeh/release/bokeh-1.3.4.min.css"/> <link rel="stylesheet" type="text/css" href="http://cdn.pydata.org/bokeh/release/bokeh-widgets-1.3.4.min.css"/> <link rel="stylesheet" type="text/css" href="http://cdn.pydata.org/bokeh/release/bokeh-tables-1.3.4.min.css"/> <div class="container text-center"> <h1>HELLO</h1> {{ div }} {{ script }} </div> </body> <script text="type/javascript" src="http://cdn.pydata.org/bokeh/release/bokeh-1.3.4.min

Adding labels in pie chart wedge in bokeh

可紊 提交于 2019-12-02 03:19:11
How do you add the information from a dataframe when creating a pie chart using bokeh? I am using code from http://docs.bokeh.org/en/latest/docs/gallery/pie_chart.html Basically, I want the values of each country in the wedge. You're able to add text to a plot with a LableSet. from math import pi import pandas as pd from bokeh.io import output_file, show from bokeh.palettes import Category20c from bokeh.plotting import figure from bokeh.transform import cumsum from bokeh.models import LabelSet, ColumnDataSource output_file("pie.html") x = { 'United States': 157, 'United Kingdom': 93, 'Japan':

bokeh responsive row with items of unequal width

久未见 提交于 2019-12-02 02:36:31
I'm trying to create a responsive row in bokeh 0.12.3 that contains a figure and a widgetbox, where the widgetbox has a much smaller width than the figure. I'm able to achieve only the former with the following: from bokeh.io import output_file, show from bokeh.layouts import row, widgetbox from bokeh.models.widgets import RadioButtonGroup, TextInput from bokeh.plotting import figure output_file("layout.html") x = list(range(11)) y0 = x y1 = [10 - i for i in x] y2 = [abs(i - 5) for i in x] # create a new plot s1 = figure(width=600, plot_height=600, title=None) s1.circle(x, y0, size=10, color=

Datetime axis in Bokeh

非 Y 不嫁゛ 提交于 2019-12-02 02:07:44
问题 for my figure I wanted to use the 'datetime' option in bokeh as following: top = figure(width=900, height=500, x_axis_type='datetime') My data for the x-axis is in the datetime.time format. x_time = [datetime.time(0, 0), datetime.time(0, 0, 3), datetime.time(0, 0, 13), datetime.time(0, 0, 23), datetime.time(0, 0, 26)] However it produces the following error when trying to add: top.image_url(x=datetime.time(0,0,3), y= 10 url = [some_url]] and top.add_layout(Arrow(x_start=datetime.time(0,0,0),

Trouble embedding Bokeh plot into Flask app

℡╲_俬逩灬. 提交于 2019-12-02 01:28:23
I'm new both to Bokeh and Flask. I browsed related questions, tutorials, and looked at Bokeh docs but could not figure out what I'm doing wrong. That being said, I want to create a simple web-app in which I "group together" various data reports and plots. According to what I read, I came up with the following: app.py: ... # imports app = Flask(__name__, static_url_path='/static') @app.route("/") def index(): return render_template("index.html") @app.route("/bokeh_test") def bokeh_test(): script, div = components(sample_plot()) return render_template("bokeh_test.html", script=script, div=div)

Rotating minor tick labels for categorical Bokeh plot

≯℡__Kan透↙ 提交于 2019-12-02 00:50:44
问题 I am trying to rotate the major- and the minor axis within a multi-categorical plot in Bokeh (similar to what is done for major tick labels here and done within matplotlib here. When having several categories, their labels/text often get smeared together. Taking some inspiration from the Bokeh documentation on Categorical Data the result, using Bokehs vbar functionality, would look something like The major axis can be set using p.xaxis.major_label_orientation = pi/4 Yet I can't find any way

Datetime axis in Bokeh

心不动则不痛 提交于 2019-12-01 23:13:52
for my figure I wanted to use the 'datetime' option in bokeh as following: top = figure(width=900, height=500, x_axis_type='datetime') My data for the x-axis is in the datetime.time format. x_time = [datetime.time(0, 0), datetime.time(0, 0, 3), datetime.time(0, 0, 13), datetime.time(0, 0, 23), datetime.time(0, 0, 26)] However it produces the following error when trying to add: top.image_url(x=datetime.time(0,0,3), y= 10 url = [some_url]] and top.add_layout(Arrow(x_start=datetime.time(0,0,0), y_start=5, x_end=datetime.time(0,0,3), y_end=10) ValueError: expected an element of either String, Dict

Rotating minor tick labels for categorical Bokeh plot

风格不统一 提交于 2019-12-01 22:04:33
I am trying to rotate the major- and the minor axis within a multi-categorical plot in Bokeh (similar to what is done for major tick labels here and done within matplotlib here . When having several categories, their labels/text often get smeared together. Taking some inspiration from the Bokeh documentation on Categorical Data the result, using Bokehs vbar functionality, would look something like The major axis can be set using p.xaxis.major_label_orientation = pi/4 Yet I can't find any way of actually doing the same for the minors... ? p.xaxis.minor[0]_label_orientation = pi/4 ? ? p.xaxis