bokeh

Turn Bokeh Glyph into a link

萝らか妹 提交于 2019-12-10 10:08:26
问题 I would like to turn all of the Bokeh glyphs on a certain plot into links to other pages. Is this possible? For example if I had a map of countries, each country as a patch, if a user were to click on a country I would like to redirect them to that wikipedia page. 回答1: There also a simpler example in the User's Guide: from bokeh.models import ColumnDataSource, OpenURL, TapTool from bokeh.plotting import figure, output_file, show output_file("openurl.html") p = figure(plot_width=400, plot

Image plot in bokeh with tight axes and matching aspect ratio

爱⌒轻易说出口 提交于 2019-12-10 04:26:51
问题 I'm using bokeh 1.0.1 version inside a Django application and I would like to display microscopic surface images as zoomable image plots with a color-encoded height and colorbar. In principle this works, but I have problems to get plots with the correct aspect ratio only showing the image without space around. Here is an example for what I want to achieve: The resulting plot should show an image of random data having a width of sx=10 and a height of sy=5 in data space (image size ) have axes

How to set active tools in Holoviews

混江龙づ霸主 提交于 2019-12-09 03:24:26
Sometimes my plots get drawn with the pan tool active and sometimes they draw with pan and wheel_zoom active. I'd like to force wheel_zoom to be active upon rendering. Is there a way to do this? Since holoviews 1.11.0 was released the original answer has been outdated. HoloViews now has an explicit option to set the active tool(s), called active_tools which accepts a list of tool names or instances, e.g. to activate the wheel_zoom tool by default you would do this: hv.Curve([1, 2, 3]).options(active_tools=['wheel_zoom']) The rest of the answer below is outdated: For any options that are not

How do you add error bars to Bokeh plots in python?

一世执手 提交于 2019-12-09 02:36:38
问题 I have successfully plotted several data sets and fitted functions using Bokeh however I really need to add error bars to the graphs, how might I go about doing this? 回答1: EDIT: This is now built into Bokeh, see the documentation: https://docs.bokeh.org/en/latest/docs/user_guide/annotations.html#whiskers and https://docs.bokeh.org/en/latest/docs/user_guide/annotations.html#bands See https://stackoverflow.com/a/46517148/3406693 for a complete example. Maybe its a little late but I wanted to do

Plotting multiple lines with Bokeh and pandas

↘锁芯ラ 提交于 2019-12-08 23:09:03
问题 I would like to give a pandas dataframe to Bokeh to plot a line chart with multiple lines. The x-axis should be the df.index and each df.columns should be a separate line. This is what I would like to do: import pandas as pd import numpy as np from bokeh.plotting import figure, show toy_df = pd.DataFrame(data=np.random.rand(5,3), columns = ('a', 'b' ,'c'), index = pd.DatetimeIndex(start='01-01-2015',periods=5, freq='d')) p = figure(width=1200, height=900, x_axis_type="datetime") p.multi_line

adding layout to tabs on bokeh dashboard

纵然是瞬间 提交于 2019-12-08 17:30:20
问题 I'm exploring the bokeh library. I tried to add several plots to each tab using VBox, but it did not work. I read somewhere that tabs & VBox/HBox cannot be used together. How do I handle the layout on the tabs then? Modified example to add several elements per tab: from bokeh.models.widgets import Panel, Tabs from bokeh.io import output_file, show from bokeh.plotting import figure from bokeh.models.widgets.layouts import VBox output_file("slider.html") p1 = figure(plot_width=300, plot_height

Updated Bokeh to 0.5.0, now plots all previous versions of graph in one window

﹥>﹥吖頭↗ 提交于 2019-12-08 16:27:17
问题 Before I updated, I would run my script and output the html file. There would be my one plot in the window. I would make changes to my script, run it, output the html file, look at the new plot. Then I installed the library again to update it using conda. I made some changes to my script, ran it again, and the output file included both the plot before I made some changes AND a plot including the changes. I ran the script again out of curiosity. Three plots in the one file! Ran it again. Four!

Bokeh Plot with equal axes

非 Y 不嫁゛ 提交于 2019-12-08 16:02:57
问题 Bokeh Plot with equal axes I created a Plot with the Python library Bokeh (see code). from bokeh.plotting import * figure() hold() rect([1,3], [1,1], [1,0.5], [1,0.5]) patch([0,0,4,4], [2,0,0,2], line_color="black", fill_color=None) show() How can I represent the squares (rectangle with the same width and height) with equal axes as in matplotlib with the command axis('equal') ? http://matplotlib.org/examples/pylab_examples/axis_equal_demo.html I see the option to change the width and height

when plotting a graph using bokeh, how to remove missing date while x_axis type is datetime ,

拜拜、爱过 提交于 2019-12-08 12:32:26
I'm recently trying to plot stock data using bokeh, the data to plot is dataframe of pandas, like date value 0 2017-01-01 10 1 2017-01-02 20 2 2017-01-03 15 3 2017-01-06 30 4 2017-01-07 25 Since there are not trades on Saturday and Sunday, there are not records in this dataframe. So this is the image I drawed Is there any way to remove the two space bar? My codes here: import pandas as pd from bokeh.plotting import figure from bokeh.io import show df = pd.DataFrame({"date":['2017-01-01','2017-01-02','2017-01-03','2017-01-06','2017-01-07']}) df["value"] = [10,20,15,30,25] print(df) width = 24

How to implement a Javascript callback for a multiselect widget in Bokeh

两盒软妹~` 提交于 2019-12-08 12:22:45
问题 I am new to both Bokeh and Javascript and I am trying to implement a simple multiselect widget in Bokeh. The idea is simply to display the x and y data on a scatterplot depending on the letter or letters chosen by the user (A, B, C). The graph should be empty before the user selects a choice. The problem lies with the Javascript callback: nothing happens when I select an entry with the MultiSelect widget. The code is below. from bokeh.models import CustomJS, ColumnDataSource, MultiSelect,