bokeh

how use bokeh vbar chart parameter with groupby object?

本秂侑毒 提交于 2019-12-02 09:31:08
Question Below code is grouped vbar chart example from bokeh documentation. There are something i can't understand on this example. Where 'cyl_mfr' is come from in factor_cmap() and vbar()? 'mpg_mean' , is it calculating the mean of 'mpg' column? if then, why 'mpg_sum' doesn't work? I want to make my own vbar chart like this example. Code from bokeh.io import show, output_file from bokeh.models import ColumnDataSource, HoverTool from bokeh.plotting import figure from bokeh.palettes import Spectral5 from bokeh.sampledata.autompg import autompg_clean as df from bokeh.transform import factor_cmap

Bokeh graph doesn't plot properly

[亡魂溺海] 提交于 2019-12-02 08:39:57
The following code doesn't generate a graph: import pandas import numpy as np from bokeh.plotting import figure, show, output_file from bokeh.io import output_notebook from datetime import datetime output_notebook() TOOLS="hover,crosshair,pan,wheel_zoom,zoom_in,zoom_out,box_zoom,undo,redo,reset,\ tap,save,box_select,poly_select,lasso_select," df = pandas.read_csv('./logs.csv') df['datetime'] = pd.to_datetime(df['datetime']) xvals = df['datetime'].dt.strftime('%Y-%m-%d') yvals = df['datetime'].dt.strftime('%H:%M:%S') p = figure(title="Test Title", width=500, height=500, \ x_axis_type="datetime"

how to show legend items of patches in bokeh

非 Y 不嫁゛ 提交于 2019-12-02 08:12:51
In the following set up, I create a area chart based on the basic example. How do I get the legend for my input automatically or even programatically. For now I get only legend with one item 'a' and the first color. from bokeh.plotting import * ... patches([x2 for a in areas], list(areas.values()), color=colors, alpha=0.8, line_color=None, legend='a', title="hello chart") legend().orientation = "top_right" # what other options, may here? show() What is the format to pass into patches for the legend as value or how can I trigger the legend() to show an item and color for every item in the plot?

How can I make legend outside plot area with stacked bar

你。 提交于 2019-12-02 08:04:11
Hello, I have a problem with Bokeh library. I need make a legend box outside plot area. It works for circle and area plotting. I can't find the solution for the stacked bar.With the solution below the legend shapes one part of the graph, it isn't acceptable (see link under the code).I would like a legend in the box. Regards, SR import numpy as np from bokeh.layouts import gridplot from bokeh.models import ColumnDataSource, NumeralTickFormatter,LinearAxis, Range1d, Legend from bokeh.plotting import show, output_notebook, figure from bokeh.core.properties import value from math import pi output

Can we specify bokeh exported png file size / resolution?

六眼飞鱼酱① 提交于 2019-12-02 06:56:02
问题 With Python Bokeh export_png function, we can export an object to png file. However, I cannot find any way to specify the resulted png file size / resolution. I found that I used the same code and got different png files in Windows and Linux. In Windows, the resolution is much lower. I understand we can use export_svgs() to have better figure file. But compared with export_png() , export_svgs() has many limitations. We cannot use export_svgs() on div, column or row objects. 回答1: There is a

How to specify n-th ticker for bokeh plot from python side, where n is the number of tickers

笑着哭i 提交于 2019-12-02 06:54:27
问题 Note from maintainers: Support for Coffeescript is deprecated and will be removed in Bokeh 2.0. The other day, I asked about how to control tickers: How to show only evey nth categorical tickers in Bokeh Now I need to supply n from outside of Coffeescript, where n is the every n-th ticker. Based on the code snippet provided by bigreddot and by referring to the code examples shown below links: https://docs.bokeh.org/en/latest/docs/user_guide/extensions_gallery/widget.html#userguide-extensions

Bokeh, lasso select to table update

可紊 提交于 2019-12-02 05:55:19
问题 I hope everyone is doing well. I am trying to develop a Bokeh interaction whereby selecting a part of a scatter plot will update a table. I am using a lot of the sample code from the Bokeh documentation. My workplace is running an older version of Bokeh (0.12.5) so I had to change the last line in the Custom JS (from s2.change.emit() to s2.trigger('change). I then added in a few lines to create a DataTable. I naively thought that since sourcing 's1' in the Datatable works, sourcing 's2' will

Toggle between linear and log scale in bokeh

主宰稳场 提交于 2019-12-02 05:44:38
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 wondering if there's a way to include a button/widget to change from linear to log scale for both the x

bokeh responsive row with items of unequal width

帅比萌擦擦* 提交于 2019-12-02 05:29:39
问题 I'm trying to create a responsive row in bokeh 0.12.3 that contains a figure and a widgetbox, where the widgetbox has a much smaller width than the figure. I'm able to achieve only the former with the following: from bokeh.io import output_file, show from bokeh.layouts import row, widgetbox from bokeh.models.widgets import RadioButtonGroup, TextInput from bokeh.plotting import figure output_file("layout.html") x = list(range(11)) y0 = x y1 = [10 - i for i in x] y2 = [abs(i - 5) for i in x] #

How to specify n-th ticker for bokeh plot from python side, where n is the number of tickers

ぐ巨炮叔叔 提交于 2019-12-02 05:27:53
The other day, I asked about how to control tickers: How to show only evey nth categorical tickers in Bokeh Now I need to supply n from outside of Coffeescript, where n is the every n-th ticker. Based on the code snippet provided by bigreddot and by referring to the code examples shown below links: https://bokeh.pydata.org/en/latest/docs/user_guide/extensions_gallery/widget.html#userguide-extensions-examples-widget How do I use custom labels for ticks in Bokeh? I came up with the following very minimal code although I don't have knowledge about Coffescript. In fact, however, it does not work.