bokeh

Bokeh, select interactivle multiple datasets for plotting

自作多情 提交于 2020-01-14 05:05:24
问题 I am new to using Bokeh. I have data which roughly looks like that date names numbers 2016 var1 62 2012 var2 82 2014 var1 118 2015 var2 69852 2012 var3 167 2016 var1 2266 2011 var1 88282 2015 var3 6307 ... I use a Bokeh script to plot the data and from a dropdown menu I can select for which names (var1, var2, ...) to to plot the data. The script is based on this example: https://github.com/bokeh/bokeh/tree/master/examples/app/weather and looks like this import pandas as pd from bokeh.io

Data Availability Chart in Python

徘徊边缘 提交于 2020-01-14 03:39:06
问题 I am wondering if Python has something to plot the data availability of time series with multiple variables. An example is shown below taken from Visavail.js - A Time Data Availability Chart. 回答1: Here's a suggestion using plotly in a Jupyter Notebook: Code: import random import pandas as pd import plotly.express as px from random import choices # random data with a somewhat higher # probability of 1 than 0 to mimic OPs data random.seed(1) vals=[0,1] prob=[0.4, 0.6] choices(vals, prob) data=[

updating bokeh plot with a bokeh widget in jupyter notebook

二次信任 提交于 2020-01-13 12:11:32
问题 I want to use bokeh widgets from within a jupyter notebook to update a bokeh plot. My (somewhat hacky) code looks like this: from bokeh.plotting import figure from bokeh.io import output_notebook, push_notebook, show from bokeh.models import CustomJS, Slider output_notebook() power = 0.5 x = [1,2,3] y = [i**power for i in x] fig = figure() plt = fig.circle(x, y) def update_plot(power): x = plt.data_source.data['x'] plt.data_source.data['y'] = [i**power for i in x] push_notebook(handle=bokeh

bokeh year on year line graph procedure

六眼飞鱼酱① 提交于 2020-01-13 06:00:30
问题 what is the best way for doing year over year line charts with daily data in bokeh? currently im adding a dateline (arbitrarily for 2016) and year column to inital dataframe of daily values. Then pivoting to wide data by year filling in NAs (missing data varies across years) and then building bokeh graph line by line across the year cols: Say I have a table of three years data: Column: Date and Value df = df.set_index('Date') df['dateline'] = df.index.to_series().dt.strftime('%d-%b-2016') df[

Toggle between linear and log scale in bokeh

ⅰ亾dé卋堺 提交于 2020-01-11 11:52:07
问题 How can I re-generate this example toggling between linear and log scales? Background: I'm a long-time Matplotlib user, recent Bokeh user. One of the main reasons I have started using Bokeh is because of the interactiveness it provides. A big part of it would be the ability to toggle between linear and log scales in plots (which is something I really need in my daily life). This question was adressed here in 2015 and at the time there was no clear answer. However, it's 2 years later and I'm

Toggle between linear and log scale in bokeh

随声附和 提交于 2020-01-11 11:48:26
问题 How can I re-generate this example toggling between linear and log scales? Background: I'm a long-time Matplotlib user, recent Bokeh user. One of the main reasons I have started using Bokeh is because of the interactiveness it provides. A big part of it would be the ability to toggle between linear and log scales in plots (which is something I really need in my daily life). This question was adressed here in 2015 and at the time there was no clear answer. However, it's 2 years later and I'm

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

旧街凉风 提交于 2020-01-09 11:19:30
问题 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. 回答1: Here is an example of a solution

Customize Bokeh Unemployment Example: Replacing Percentage Value

旧巷老猫 提交于 2020-01-06 08:08:37
问题 starter code: https://docs.bokeh.org/en/latest/docs/gallery/texas.html I am trying to replace the unemployment percentage with a different percentage that I have in a csv file. The csv columns are county name and concentration. I am using the same call method for the county data as in the example. Just pulling in different data for the percentage value. I have tried turning the csv into a dictionary to then look up the county name value and return the corresponding concentration using the

Customize Bokeh Unemployment Example: Replacing Percentage Value

旧街凉风 提交于 2020-01-06 08:08:03
问题 starter code: https://docs.bokeh.org/en/latest/docs/gallery/texas.html I am trying to replace the unemployment percentage with a different percentage that I have in a csv file. The csv columns are county name and concentration. I am using the same call method for the county data as in the example. Just pulling in different data for the percentage value. I have tried turning the csv into a dictionary to then look up the county name value and return the corresponding concentration using the

How to perform an onclick action on button click in python bokeh?

大城市里の小女人 提交于 2020-01-06 07:27:59
问题 I'm new to bokeh and I have aquery regarding button onclick event, the code is provided below: x = widgetbox(button) show(x) fruits = ['Answered', 'Unanswered','Total'] top1=[1,2,3] def callback(): p = figure(x_range=fruits, plot_height=250, title="sophia bot") p.vbar(x=fruits, top=top1, width=0.9) p.xgrid.grid_line_color = None p.y_range.start = 0 output_file("abc.html") show(p) button_one = Button(label="Start", disabled=True, callback=callback) show(button_one) but this isnt performing the