bokeh

bokeh widget: custom css

筅森魡賤 提交于 2019-12-10 14:12:28
问题 Is there any way to provide a custom CSS when making widgets in bokeh? E.g.: country_picker = widgets.MultiSelect(value=[], title='country', options=list(self.df['country_code'].unique()) + ['All'], width=180, height=120, css=""".bk-layout-scale_height .bk widget-form-input { height: 180px !important;} """) I have one particular multi-selector that has 60+ options, so I'd like to make it high. While I'd like to keep other multi-selectors small. 回答1: With the related PR5503 which has been

TimeSeries in Bokeh using a dataframe with index

痞子三分冷 提交于 2019-12-10 12:55:23
问题 I'm trying to use Bokeh to plot a Pandas dataframe with a DateTime column containing years and a numeric one. If the DateTime is specified as x , the behaviour is the expected (years in the x-axis). However, if I use set_index to turn the DateTime column into the index of the dataframe and then only specify the y in the TimeSeries I get time in milliseconds in the x-axis. A minimal example import pandas as pd import numpy as np from bokeh.charts import TimeSeries, output_file, show output

Log scale using Bokeh's scatter function

坚强是说给别人听的谎言 提交于 2019-12-10 12:39:00
问题 How do I get log scales when using Bokeh's scatter function. I'm looking for something like the following: scatter(x, y, source=my_source, ylog=True) or scatter(x, y, source=my_source, yscale='log') 回答1: Something along these lines will work: import numpy as np from bokeh.plotting import * N = 100 x = np.linspace(0.1, 5, N) output_file("logscatter.html", title="log axis scatter example") figure(tools="pan,wheel_zoom,box_zoom,reset,previewsave", y_axis_type="log", y_range=[0.1, 10**2], title=

Histogram with slider filter

蹲街弑〆低调 提交于 2019-12-10 12:22:54
问题 I would like to create a histogram with a density plot combined in bokeh with a slider filter. Atm, I have the blocks to create a bokeh histogram with a density plot from another thread. I dont know how to create the callback function to update the data and rerender the plot. from bokeh.io import output_file, show from bokeh.plotting import figure from bokeh.sampledata.autompg import autompg as df from numpy import histogram, linspace from scipy.stats.kde import gaussian_kde pdf = gaussian

Running Bokeh Server on Local Network

走远了吗. 提交于 2019-12-10 12:05:49
问题 I have a simple Bokeh app named app.py as follows: ### contents of app.py from bokeh.client import push_session from bokeh.embed import server_document from bokeh.plotting import figure, curdoc plot = figure() plot.circle([1,2], [3,4]) doc = curdoc() doc.add_root(plot) I can run this app with the following command: bokeh serve app.py I can then access the plot through my web browser: http://localhost:5006/app. However, I would like the plot to be available to all devices on my private network

Embedding plot to web page using rbokeh

懵懂的女人 提交于 2019-12-10 11:51:44
问题 I have created a plot in R using rbokeh and I want to convert it to HTML/Javascript in order to embed it inside a web page. I'm currently able to achieve this with mpld3 on Python (and I know that bokeh on python does it too) but I want to be able to do this with rbokeh in R. So basically I'm looking for something similar to Python's mpld3.fig_to_html(), e.g: fig, ax = plt.subplots() ax.p1 = plt.bar(...) html = mpld3.fig_to_html(fig) # <- converts the plot to html/javascript! print html #

Passing arguments to Bokeh autoload_server from Flask api

吃可爱长大的小学妹 提交于 2019-12-10 11:37:51
问题 I started using Bokeh last week, so very much new to it, I am trying to create an interactive bar chart using sliders and dropdowns embedded in Flask API, so I created the flask api for the same, its showing the chart with a slider and dropdown but its not dynamically updating the chart upon changing the slider/dropdown value. Then upon further research I found out that I need to have a separate bokeh server running for the interaction part and call the autoload server from my Flask api. But

Adding color to bokeh datatable header

老子叫甜甜 提交于 2019-12-10 10:41:11
问题 I created a bokeh datatable and was wondering how can I format the column header to have a blue background, any help is appreciated. thanks 回答1: Unfortunately this is not completely non-trivial to do. SlickGrid (which is the basis of DataTable ) has many dozens of CSS configurable properties, so exposing them all as Python properties on Bokeh models is prohibitive. So, you will have to target the SlickGrid CSS directly in a template. Things vary somewhat depending on details you have not

Example: how do I make bokeh omit missing dates when using datetime as x-axis

假装没事ソ 提交于 2019-12-10 10:39:26
问题 I was looking for a way to eliminate the "spaces" in the x-axis where there is no data, this for a bokeh graph. Then I stumbled on an example here: How do I make bokeh omit missing dates when using datetime as x-axis The example: from math import pi import pandas as pd from bokeh.sampledata.stocks import MSFT from bokeh.plotting import figure, show, output_file from bokeh.models.formatters import TickFormatter, String, List # In this custom TickFormatter, xaxis labels are taken from an array

Plotting Bar Charts with Bokeh

馋奶兔 提交于 2019-12-10 10:37:29
问题 I am trying to plot a basic barchart but I keep seeing an error called 'StopIteration'. I am following an example, and the code seems fine: amount = bugrlary_dict.values() months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"] print len(amount) print len(months) bar = Bar(amount, months, filename="bar.html") bar.title("Bar Chart of the Amount of Burglaries").xlabel("Months").ylabel("Amount") bar.show() 回答1: UPDATE this answer is out of date and will not work with