bokeh

How to add text to html files generated by Python Bokeh

岁酱吖の 提交于 2020-01-03 09:07:19
问题 How do I add text to the HTML files for plots that are generated by bokeh. I don't see any API for specifically writing text on the files. All you can do is make plots. 回答1: There are alot of ways to embed Bokeh plots in other documents. For static documents, you can have Bokeh create its standard default document, or you can have it use a template you provide. You can also generate just the div and script tags and then embed those in your own static pages or web-apps however you like. Any of

Python Bokeh callback external python function

天涯浪子 提交于 2020-01-03 06:19:06
问题 I would like to call an external python function to get the callcack modification which I cannot using javascript math. How can I do this? 回答1: It is not possible to call python functions directly from JavaScript callbacks. The JS callback code is executing in the browser, which is not the same process as a python interpreter. If you want to have user interactions, or tools, or callbacks that trigger real, actual python functions, you will have to use the Bokeh server (this is in fact what it

Assign color to NetworkX node based on column name

核能气质少年 提交于 2020-01-03 04:23:07
问题 I am attempting to build a network graph using NetworkX and Bokeh. I am using the NetworkX from_pandas_edgelist function to add data for the graph. I would like to color the node of the graph based on the column in the initial data input. The relation DataFrame is as follows: company client Google AT&T Google Cisco Amazon Facebook Amazon Snap Amazon Microsoft Apple Intel Apple IBM Apple Visa The above snippet is only a portion of the DataFrame. I would like all of the nodes from company to

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

柔情痞子 提交于 2020-01-03 01:44:31
问题 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

How to make one slider/widget update multiple plots in Bokeh/Python/Pywidgets?

谁说胖子不能爱 提交于 2020-01-02 17:07:13
问题 Using Jupyter notebook, how to have one slider interactively update two independent functions in two figures? There is a link to a similar question without answer here. Using Bokeh Javascript Callback slider power example, I tried adding a second set of variables x and y but keep using the same callback. The graphs do not update anymore. Any suggestions? I also was trying to do the same with Pywidget but did not get anywhere. I would prefer using IPywidget if there is a solution there. The

How to make one slider/widget update multiple plots in Bokeh/Python/Pywidgets?

大憨熊 提交于 2020-01-02 17:05:18
问题 Using Jupyter notebook, how to have one slider interactively update two independent functions in two figures? There is a link to a similar question without answer here. Using Bokeh Javascript Callback slider power example, I tried adding a second set of variables x and y but keep using the same callback. The graphs do not update anymore. Any suggestions? I also was trying to do the same with Pywidget but did not get anywhere. I would prefer using IPywidget if there is a solution there. The

Bokeh Plot with a nominal or ordinal axis type

痴心易碎 提交于 2020-01-02 11:06:11
问题 Edit: The code in the original question refers to a version of Bokeh that is years out of date. But the answer below has been updated to answer the same question for modern versions of Bokeh Bokeh Plot with a nominal axis type from bokeh.plotting import * from bokeh.objects import * output_notebook() label = ['United States', 'Russia', 'South Africa', 'Europe (average)', 'Canada', 'Austalia', 'Japan'] number = [1, 2, 3, 4, 5, 6, 7] value = [700, 530, 400, 150, 125, 125, 75] yr = Range1d(start

Color nodes by Networkx node attribute with Bokeh

大城市里の小女人 提交于 2020-01-01 18:28:28
问题 I'm trying to use bokeh to create an interactive network visualization. I understand how to add attribtue data to the bokeh graph, but I'm not sure how to assign a fill color based on the node attribute. I've been following all of the bokeh examples that I can find, but I can't seem to figure it out. How can I adjust my code below to color the nodes by their NetworkX node attributes? import networkx as nx from bokeh.io import show, output_notebook from bokeh.plotting import figure from bokeh

Have Bokeh Callback update a list instead of a ColumnDataSource?

二次信任 提交于 2020-01-01 14:53:11
问题 My question has to do with modifying this example from the Bokeh Gallery. I have a matrix m or raw data, in which every row corresponds to a pair of x,y coordinates in a transformed space (see #MockData part of code). The x,y coordinates are plotted on the left plot. I am trying to change the example so that, when I select some points in the left figure, the right figure will display line plots of the corresponding rows. I've narrowed the problem down to the point, where the right figure will

How do you add more x axis ticks and labels to datetime axis using Python's Bokeh?

北城余情 提交于 2020-01-01 04:46:05
问题 I've been testing out Python's Bokeh, specifically the candlestick chart tools but have been unable to figure out how to add more than 5 datetime labels/ticks to my chart. Any insight would be appreciated. Here's the code: from math import pi import pandas as pd import pandas.io.data as web from bokeh.plotting import * stocks = 'FB' ####################################################### date_today = time.strftime("%x") def get_px(stock, start, end): return web.get_data_yahoo(stock, start,