bokeh

Embedding a bokeh app in flask

一笑奈何 提交于 2019-11-29 00:53:54
问题 I am trying desperately to embed a working bokeh applet into flask, and can't find a proper way to do this. I looked through all the examples, but I can't find one which includes the ability to update the data (best example: the sliders_applet). If I'm not mistaken, I do need the bokeh-server to be able to change the data (with sliders etc.). Starting the applet this way works, e.g.: bokeh-server --script sliders_app.py But I can't find the proper, or at least a working way to embed the

Position of the legend in a Bokeh plot

百般思念 提交于 2019-11-28 21:19:24
Does anyone know how to carry the legend in bokeh outside of the graph? The only manipulation I could do was to choose a position among: top_right, top_left, bottom_left or bottom_right using: legend()[0].orientation = "bottom_left" and when I try different ones I get the error message: ValueError: invalid value for orientation: 'outside'; allowed values are top_right, top_left, bottom_left or bottom_right bigreddot As of Bokeh 0.12.4 it is possible to position legends outside the central plot area. Here is a short example from the user's guide : import numpy as np from bokeh.models import

Bokeh Plotting: Enable tooltips for only some glyphs

吃可爱长大的小学妹 提交于 2019-11-28 20:29:53
I have a figure with some glyphs, but only want tooltips to display for certain glyphs. Is there currently a way to accomplish this in Bokeh? Alternatively, is there a way to plot two figures on top of each other? It seems like that would let me accomplish what I want to do. Thanks to this page in Google Groups I figured out how this can be done. Link here Edit 2015-10-20 : looks like the google group link doesn't work anymore unfortunately. It was a message from Sarah Bird @bokehplot. Edit 2017-01-18 : Currently this would add multiple hover tool icons to the tool bar. This may cause problems

In Bokeh, how do I add tooltips to a Timeseries chart (hover tool)?

半世苍凉 提交于 2019-11-28 20:13:40
Is it possible to add Tooltips to a Timeseries chart? In the simplified code example below, I want to see a single column name ('a','b' or 'c') when the mouse hovers over the relevant line. Instead, a "???" is displayed and ALL three lines get a tool tip (rather than just the one im hovering over) Per the documentation ( http://bokeh.pydata.org/en/latest/docs/user_guide/tools.html#hovertool ), field names starting with “@” are interpreted as columns on the data source. How can I display the 'columns' from a pandas dataframe in the tooltip? Or, if the high level TimeSeries interface doesnt

One chart with two different y axis ranges in Bokeh?

流过昼夜 提交于 2019-11-28 17:14:20
I would like a Bar chart with Quantity information on the left y-axis, and then overlay a Scatter/Line plot with Yield % on the right. I can create each of these charts separately, but do not know how to combine them into a single plot. In matplotlib, we would create a second figure using twinx() , and then use yaxis.tick_left() and yaxis.tick_right() on the respective figures. Is there a method for doing something similar with Bokeh? tomaskazemekas Yes, now it is possible to have two y axes in Bokeh plots. The code below shows script parts significant in setting up the second y axis to the

Bokeh, how to change column used for glyph colors with CustomJS callbacks?

有些话、适合烂在心里 提交于 2019-11-28 12:45:18
I'm using Bokeh to create scatter plots by passing a ColumnDataSource to the figure.circle function. The data source has columns that designate certain colors for each point, with a hex code in each row, because the coloring scheme I want to use is somewhat complicated. Is there a way to change the column used to color the circles in the callback of a widget? I'm imagining a dropdown menu allowing users to choose various coloring schemes for the points. Here is an example of a solution using a models.Select widget and models.CustomJS to select out of two coloring schemes defined in the

Flask + Bokeh AjaxDataSource

依然范特西╮ 提交于 2019-11-28 11:10:24
Struggling with Flask + Bokeh AjaxDataSource: I have a function that returns json data: @app.route("/data", methods=['POST']) def get_x(): global x, y x = x + 0.1 y = math.sin(x) return flask.jsonify(x=[x], y=[y]) I can use use it with a Bokeh AjaxDataSource no problem to create a streaming plot: source = AjaxDataSource(data_url="http://localhost:5000/data", polling_interval=1000, mode='append') p = figure() p.line('x', 'y', source=source) show(p) However, when I try to embed this in a flask page, the AjaxDataSource does not query the server. The plot fails to render with no errors. Note that

How to show only evey nth categorical tickers in Bokeh

我与影子孤独终老i 提交于 2019-11-28 10:18:39
问题 There was the same question two years ago. It seemed that evey nth categorical tickers was not supported at that time. https://stackoverflow.com/questions/34949298/python-bokeh-show-only-every-second-categorical-ticker My bokeh version is 0.12.13. I wonder it is supported now. Simply setting p.xaxis.ticker = ['A', 'B, 'C'] does not work(error is thrown) In my dashbaord, the initial plot size is one quarter of browser view port and the x axis is crowded with many ticker and labels. So I want

What to use instead of bokeh.charts

半城伤御伤魂 提交于 2019-11-28 03:17:13
问题 I am trying to run some code written by someone else, which contains the line from bokeh.charts import Bar When I run this in the Anaconda Prompt, I get the message "No module named 'bokeh.charts'". I have installed bokeh 0.12.13, so the problem isn't that I haven't installed it. Indeed, other bokeh modules run fine. I have noticed on the bokeh website that the 'charts' module says that it refers to a previous version (see https://docs.bokeh.org/en/0.12.4/docs/reference/charts.html). Does the

With Bokeh, how to save to a png or jpg instead of a html file?

和自甴很熟 提交于 2019-11-28 02:28:12
问题 I need to export pictures of the graphs and plots I am creating with Bokeh. Usually I do output_file("test.html") However, I want to copy that graph into an Excel Sheet. It does not have to be interactive anymore, though that would be brillant. How do I export the graph as a picture? Using code, not clicking on "preview/save". 回答1: As of Bokeh 0.12.6 , it is now possible to export PNG and SVG directly from Python code. Exporting PNGs looks like this export_png(plot, filename="plot.png") And