bokeh

Changing ticks mark period in Holoviews heatmap

被刻印的时光 ゝ 提交于 2019-12-08 11:28:16
问题 I have the following heatmap made by Holoviews. I need to change x ticks to change the period of x ticks. [0,2,4,...] instead of [0,1,2,3,4,..] data = [(i, j, i*j) for i in range(10) for j in range(10)] hv.HeatMap(data) Change from this graph To this graph 回答1: It seems that bokeh doesn't provide such function. However you can change the doFormat function of xaxis.formatter before draw the plot. After run the following cell: from bokeh.models import CustomJS import holoviews as hv hv

Pointing out a single dot with text input

自作多情 提交于 2019-12-08 09:54:22
问题 i want to plot my gensim-word2vec model in kind of a "word-galaxy"(like here: http://www.anthonygarvan.com/wordgalaxy/) and flashing out a single dot by entering it's name in a search field and pressing a submit-button. I'm fairly new to all this python-stuff and so i actually don't understand the curdoc documentation or the example here: https://github.com/bokeh/bokeh/tree/master/examples/app/movies. This is my code: from bokeh.plotting import figure, output_file, show, ColumnDataSource from

bokeh add legend to Step graph

允我心安 提交于 2019-12-08 09:10:14
问题 How can I add a legend to lines in Step graph example for bokeh: https://docs.bokeh.org/en/latest/docs/reference/models/glyphs/step.html I would like to have legend in 'top right' corner of plot for each line in color and style of the line. The default code for the example is: import numpy as np from bokeh.models import ColumnDataSource, DataRange1d, Plot, LinearAxis, Grid from bokeh.models.glyphs import Step from bokeh.io import curdoc, show N = 11 x = np.linspace(-2, 2, N) y = x**2 source =

Bokeh linking/ brushing based on column instead of row indices / index

不打扰是莪最后的温柔 提交于 2019-12-08 08:57:28
I have Pandas DataFrame that is similar to this: person activities hours foodeaten 0 1 a 3 12 1 1 b 4 14 2 1 c 6 34 3 2 a 2 45 4 2 b 7 67 5 3 a 5 5 6 3 b 3 -1 7 3 c 2 3 8 3 d 12 5 I would like to plot the hours spent by a person on a activity, per activity. so, plot 1: activity a, with x=persons y=hours for activity a plot 2: activity b, with x=persons y=hours for activity b etc. I want to link the plots based on persons, not on index. So when I select the circle for person 1 in plot 1, this person's hours in the other plots should highlight, for my purpose as well. MWE: from bokeh.io import

when plotting a graph using bokeh, how to remove missing date while x_axis type is datetime ,

﹥>﹥吖頭↗ 提交于 2019-12-08 07:51:18
问题 I'm recently trying to plot stock data using bokeh, the data to plot is dataframe of pandas, like date value 0 2017-01-01 10 1 2017-01-02 20 2 2017-01-03 15 3 2017-01-06 30 4 2017-01-07 25 Since there are not trades on Saturday and Sunday, there are not records in this dataframe. So this is the image I drawed Is there any way to remove the two space bar? My codes here: import pandas as pd from bokeh.plotting import figure from bokeh.io import show df = pd.DataFrame({"date":['2017-01-01','2017

Bokeh heatmap from Pandas confusion matrix

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 07:35:59
问题 How can a Pandas DataFrame be shown as a Bokeh heatmap? https://docs.bokeh.org/en/latest/docs/user_guide/categorical.html#heat-maps shows some example, but trying to modify always only gave an empty plot. Example confusion matrix: df = pd.DataFrame([[10, 0, 1], [1, 10, 0], [1, 1, 9]], columns=['A', 'B', 'C'], index=['A', 'B', 'C']) df.index.name = 'Treatment' df.columns.name = 'Prediction' 回答1: First import packages and prepare data.frame : import pandas as pd from bokeh.io import output_file

Using bokeh to plot interactive pie chart in Jupyter/Python

巧了我就是萌 提交于 2019-12-08 06:44:39
问题 I am new to Bokeh and I would really appreciate some help in figuring out how to use Bokeh to plot a simple interactive pie chart in Jupyer/Python. I am planning to use 'CustomJS with a Python function' in Bokeh as explained at the bottom of the page here. The pie chart consists of two entries with a slider that can change the shape of one pie 'v2' inside the circle shape of (v1+v2). I have tried to follow the example in bokeh website that shows the interactivity with a sine plot, but I just

Select columns (not rows) in Bokeh Table Widget?

北战南征 提交于 2019-12-08 05:28:33
问题 I have a bokeh table that is linked to a plot, and is working as intended. Selecting a row in the table mutes all the non-selected rows in the plot display. However, what if someone wants to select a column, and hide all other columns in the plot? Is this possible using a bokeh widget? Or does some custom code need to be written for this feature? I have attached to code used to produce the widget table on the bokeh website, as it is the most simple example I can think of (and quickest). from

Bokeh linking/ brushing based on column instead of row indices / index

ε祈祈猫儿з 提交于 2019-12-08 05:06:38
问题 I have Pandas DataFrame that is similar to this: person activities hours foodeaten 0 1 a 3 12 1 1 b 4 14 2 1 c 6 34 3 2 a 2 45 4 2 b 7 67 5 3 a 5 5 6 3 b 3 -1 7 3 c 2 3 8 3 d 12 5 I would like to plot the hours spent by a person on a activity, per activity. so, plot 1: activity a, with x=persons y=hours for activity a plot 2: activity b, with x=persons y=hours for activity b etc. I want to link the plots based on persons, not on index. So when I select the circle for person 1 in plot 1, this

Unable to embed JSON Bokeh Plot in Django template

久未见 提交于 2019-12-08 05:04:32
问题 I have a script which takes uploaded data, munges it together, turns it into a plot (using Bokeh) and then exports it to a directory as JSON. At some point in the future, a user can hit the right URL and the appropriate plot should be displayed to the user as part of the HTML template. I can generate the plot. I can save it as JSON. I can get the URL to retrieve it as JSON, but I cannot get the JSON plot to render within the template. I've had a dig around the Bokeh documentation and examples