bokeh

Is there a way to format the widgets' contents?

情到浓时终转凉″ 提交于 2019-12-18 09:15:11
问题 Let's say I'd like to underline a word in one of my options in a RadioButtonGroup, is it possible? I tried to use the Div class as an input, but it didn't work. Thanks 回答1: This PR "Add support for specifying CSS classes on all LayoutDOM" will be going into Bokeh 0.12.4 in Dec 2017 and provided a mechanism to add arbitrary CSS classes to any Bokeh LayoutDOM model (e.g. widgets) so that they can be more easily styled. It will be available like: from bokeh.models import Div div = Div(text="some

Adding labels in pie chart wedge in bokeh

北城以北 提交于 2019-12-18 09:04:33
问题 How do you add the information from a dataframe when creating a pie chart using bokeh? I am using code from http://docs.bokeh.org/en/latest/docs/gallery/pie_chart.html Basically, I want the values of each country in the wedge. 回答1: You're able to add text to a plot with a LableSet. from math import pi import pandas as pd from bokeh.io import output_file, show from bokeh.palettes import Category20c from bokeh.plotting import figure from bokeh.transform import cumsum from bokeh.models import

using MultiSelect widget to hide and show lines in bokeh

笑着哭i 提交于 2019-12-18 07:06:54
问题 I'm working with four sets of data, each of them have several number of time series. i'm using bokeh for plotting all of them together, the result looks like this: multiline graph bokeh with widget from bokeh.plotting import figure, output_file, show from bokeh.palettes import RdYlGn4 from bokeh.models import CustomJS, ColumnDataSource, MultiSelect from bokeh.layouts import row, widgetbox output_file("graph.html") p = figure(plot_width=1000, plot_height=400, x_axis_type="datetime", title=

HoverTool for multiple data series in bokeh scatter plot

南楼画角 提交于 2019-12-18 03:19:07
问题 I have the following small example script making use of numpy and bokeh: import numpy as np import bokeh.plotting as bp from bokeh.objects import HoverTool bp.output_file('test.html') fig = bp.figure(tools="reset,hover") x = np.linspace(0,2*np.pi) y1 = np.sin(x) y2 = np.cos(x) s1 = fig.scatter(x=x,y=y1,color='#0000ff',size=10,legend='sine') s1.select(dict(type=HoverTool)).tooltips = {"x":"$x", "y":"$y"} s2 = fig.scatter(x=x,y=y2,color='#ff0000',size=10,legend='cosine') s2.select(dict(type

Bokeh how to add legend to figure created by multi_line method?

浪子不回头ぞ 提交于 2019-12-17 19:37:09
问题 I'm trying to add legend to a figure, which contains two lines created by multi_line method. Example: p = figure(plot_width=300, plot_height=300) p.multi_line(xs=[[4, 2, 5], [1, 3, 4]], ys=[[6, 5, 2], [6, 5, 7]], color=['blue','yellow'], legend="first") In this case the legend is only for the first line. When the legend is defined as a list there is an error: p.multi_line(xs=[[4, 2, 5], [1, 3, 4]], ys=[[6, 5, 2], [6, 5, 7]], color=['blue','yellow'], legend=["first","second"]) Is it possible

How can I accomplish `set_xlim` or `set_ylim` in Bokeh?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-17 11:18:55
问题 I create a figure in a function, e.g. import numpy from bokeh.plotting import figure, show, output_notebook output_notebook() def make_fig(): rows = cols = 16 img = numpy.ones((rows, cols), dtype=numpy.uint32) view = img.view(dtype=numpy.uint8).reshape((rows, cols, 4)) view[:, :, 0] = numpy.arange(256) view[:, :, 1] = 265 - numpy.arange(256) fig = figure(x_range=[0, c], y_range=[0, rows]) fig.image_rgba(image=[img], x=[0], y=[0], dw=[cols], dh=[rows]) return fig Later I want to zoom in on the

How can I accomplish `set_xlim` or `set_ylim` in Bokeh?

感情迁移 提交于 2019-12-17 11:18:12
问题 I create a figure in a function, e.g. import numpy from bokeh.plotting import figure, show, output_notebook output_notebook() def make_fig(): rows = cols = 16 img = numpy.ones((rows, cols), dtype=numpy.uint32) view = img.view(dtype=numpy.uint8).reshape((rows, cols, 4)) view[:, :, 0] = numpy.arange(256) view[:, :, 1] = 265 - numpy.arange(256) fig = figure(x_range=[0, c], y_range=[0, rows]) fig.image_rgba(image=[img], x=[0], y=[0], dw=[cols], dh=[rows]) return fig Later I want to zoom in on the

How do I use custom labels for ticks in Bokeh?

落花浮王杯 提交于 2019-12-17 07:33:22
问题 I understand how you specify specific ticks to show in Bokeh, but my question is if there is a way to assign a specific label to show versus the position. So for example plot.xaxis[0].ticker=FixedTicker(ticks=[0,1]) will only show the x-axis labels at 0 and 1, but what if instead of showing 0 and 1 I wanted to show Apple and Orange. Something like plot.xaxis[0].ticker=FixedTicker(ticks=[0,1], labels=['Apple', 'Orange']) A histogram won't work for the data I am plotting. Is there anyway to use

slider widget with pandas dataframe

亡梦爱人 提交于 2019-12-14 04:26:49
问题 I want to make a interactive bokeh plot using slider widget. I have a dataframe with simple values and want to filter out some values using the slider widget. below is my test code.. df = pd.DataFrame({'x':[11,12,13,14,15],'y':[22,23,24,25,26],'threshold':[1,2,3,4,5]}) source = ColumnDataSource(data=df) plot = Figure(plot_width=400, plot_height=400) plot.circle('x', 'y', source=source) slider = Slider(start=1, end=5, value=1, step=1, title="threshold") callback = CustomJS( args=dict(source

Bokeh Plot Update Using Slider

北城以北 提交于 2019-12-14 03:59:39
问题 I am trying to use a slider to update my Bokeh Plot. I am finding it difficult to achieve it using pandas dataframe(did not find any examples so far). The other way is to use the "columndatasource" (found some examples over forums) but still not able to achieve the functionality. So I have two columns, X axis is date and the Y axis is Volume. I want to change my Y values based on slider input. I am able to see the plot but the slider functionality is not working Any help will be very much