bokeh

Bokeh Interactive legend hide multiple glyphs

不问归期 提交于 2019-12-07 01:10:53
问题 I've enabled the hide legend option for my dataset. When I click it, only one bar goes off and others stay. I'm not quite sure what is causing the issue. Here's the bar plot before and after: . Here's what my data looks like: Here's the code: p = Bar(output,'Programs',values="Averages", group="University",plot_width=600,plot_height=400, title="Comparison") p.legend.click_policy="hide" output_file("bar.html") show(p) 回答1: It is not currently (Bokeh 0.12.6) possible to hide all the bars via

Automatically fit Bokeh plot to screen?

℡╲_俬逩灬. 提交于 2019-12-06 21:27:09
问题 Is there a simple way to automatically fit a Bokeh plot to the screen used to display your browser? Right now I'm setting the plot width and height manually. Note: when I say fit I mean that I want the plot to fill 80% of the visible screen. 回答1: In more recent bokeh versions, yes you can do this (easily). plots and layouts now have a sizing_mode property which by default is set to fixed . The other values include scale_width , scale_height , and scale_both . import bokeh.plotting import

What's the command to “reset” a bokeh plot?

徘徊边缘 提交于 2019-12-06 21:20:04
问题 I have a bokeh figure that has a reset button in the toolbar. Basically, I want to "reset" the figure when I update the data that I'm plotting in the figure. How can I do that? 回答1: UPDATE: A PR has been submitted for this feature. After Bokeh 0.12.16 is released, the following will work: from bokeh.io import show from bokeh.layouts import column from bokeh.models import Button, CustomJS from bokeh.plotting import figure p = figure(tools="reset,pan,wheel_zoom,lasso_select") p.circle(list

Upload a CSV file and read it in Bokeh Web app

大憨熊 提交于 2019-12-06 19:50:46
问题 I have a Bokeh plotting app, and I need to allow the user to upload a CSV file and modify the plots according to the data in it. Is it possible to do this with the available widgets of Bokeh? Thank you very much. 回答1: Although there is no native Bokeh widget for file input. It is quite doable to extend the current tools provided by Bokeh. This answer will try to guide you through the steps of creating a custom widget and modifying the bokeh javascript to read, parse and output the file. First

How to stop bokeh from opening a new tab in Jupyter Notebook?

做~自己de王妃 提交于 2019-12-06 18:50:15
问题 First of all, before this is tagged as duplicate, I have read the other solutions and unfortunately none of them worked for me. My problem is that I want to display a bokeh plot in Juypter Notebook (and only in Jupyter Notebook), not in a new tab/window. In the official documentation here I am told that I only need to change output_file to output_notebook Even though the plot is now displayed inline if I do that, bokeh won't stop also opening a new tab and needlessly displaying the plot there

Using bokeh to plot interactive pie chart in Jupyter/Python

和自甴很熟 提交于 2019-12-06 17:46:26
I am new to Bokeh and I would really appreciate some help in figuring out how to use Bokeh to plot a simple interactive pie chart in Jupyer/Python. I am planning to use 'CustomJS with a Python function' in Bokeh as explained at the bottom of the page here . The pie chart consists of two entries with a slider that can change the shape of one pie 'v2' inside the circle shape of (v1+v2). I have tried to follow the example in bokeh website that shows the interactivity with a sine plot, but I just cannot get it to work with my pie chart. Any help would be greatly appreciated. Below is the code

How to set node size and color in bokeh network graph?

会有一股神秘感。 提交于 2019-12-06 15:46:26
If we take the standard Karate Club example, how do I change the color and size of the nodes according to their degree? import networkx as nx from bokeh.io import show, output_file from bokeh.models import Plot, Range1d, MultiLine, Circle, HoverTool, TapTool, BoxSelectTool from bokeh.models.graphs import from_networkx, NodesAndLinkedEdges, EdgesAndLinkedNodes from bokeh.palettes import Spectral4 G=nx.karate_club_graph() plot = Plot(plot_width=400, plot_height=400, x_range=Range1d(-1.1,1.1), y_range=Range1d(-1.1,1.1)) plot.title.text = "Graph Interaction Demonstration" plot.add_tools(HoverTool

How to fit bokeh plot size dynamically

此生再无相见时 提交于 2019-12-06 15:36:11
问题 My questions is very similar to the one asked yesterday: Bokeh resize plot dynamically But since I feel a solution may be a little bit different between the two, I would like to post my own. also I copy the entire code so that anyone can just copy/paste and run it. In the below code, I basically want the second Bokeh plot to take up the entire view port when I click on the title and return to the original size on the next click. As a side information, I borrowed part of the code from github.

Bokeh: How to change extra axis visibility

China☆狼群 提交于 2019-12-06 15:11:56
问题 I know I can turn axes on and off in bokeh with p1.xaxis.visible = None or p1.yaxis.visible = None from Hide Axis in Bokeh. What if I have an extra y range I want to change the visibility of? I've defined my extra axis like this: plot.extra_y_ranges = {'ORP': Range1d(start=0, end=plot_d['y_axis2_max'])} plot.add_layout(LinearAxis(y_range_name='ORP', axis_label='ORP, mV'), 'left') I tried plot.extra_y_ranges.visible = None but it has no effect, and I wasn't able to find anything in the

Unable to embed JSON Bokeh Plot in Django template

早过忘川 提交于 2019-12-06 14:51:30
I have a script which takes uploaded data, munges it together, turns it into a plot (using Bokeh) and then exports it to a directory as JSON. At some point in the future, a user can hit the right URL and the appropriate plot should be displayed to the user as part of the HTML template. I can generate the plot. I can save it as JSON. I can get the URL to retrieve it as JSON, but I cannot get the JSON plot to render within the template. I've had a dig around the Bokeh documentation and examples, but they all seem to use a flask app to serve the pages. I think I'm on the right track, using views