bokeh timeseries chart axis dateslider - python

Is it possible to display a datetime axis for a timeseries chart as a dateslider widget in Bokeh? So that the chart history updates with the range selected via the dateslider?
If so, can you please provide an example?

There is an example of the RangeTool in the documentation gallery:
https://docs.bokeh.org/en/latest/docs/gallery/range_tool.html

Related

python plotly show x axis tics in slider

I am using plotly to show some graph. I add a slider as shown in the picture. I would like to add the x values in the axis of the slider as shown in the pic:
fig.update_layout(xaxis=dict(autorange=True,
range[df.index.to_list()[0], df.index.to_list()[-1]], rangeslider=dict(autorange=True,
range=[df.index.to_list()[0], df.index.to_list()[-1]],
bordercolor="red",
borderwidth=3,
visible=True,
#### HERE code to show the axis ####),
type="date"),
https://plotly.com/python/reference/layout/xaxis/#layout-xaxis-rangeselector
I dont see any possibility in the API to show the x axis of the slider, but it should be possible. Any idea?
I think this is impossible to do with plotly. As you see in the API docs you just sent the link of, there is no attribute like “showxaxis” or the like.

Plot errorbar using panel and hvplot

I have a dataframe with some values y and their uncertainties, from df I generate an interactive dataframe idf = df.interactive(), apply some widgets from panel (pn.widgets.RadioButtonGroup) and then I plot everything via a pipeline pipeline= (idf.groupby([some stuff])['y'].mean().
Afterwards I generate a plot using pipeline.hvplot which I can later incorporate in a panel template.
My question is: how can I add to the hvplot the errobars?
Thanks a lot!

Bokeh vbar with group counts after filtering with a CDSView

I'd like to create a Bokeh vertical bar chart (vbar) coupled with a scatter plot. I need to start from a given ColumnDataSource (then filtered with a CDSView), as this is only a part of a complex visualization and I need all the plots to be linked together.
The only tricky part for which I didn't find anything about after extensive research is: how to show counts (i.e., the values provided in the top parameter of vbar) based only on data points that are both filtered AND selected in the scatter plot? Both the plots receive the same filters from which a view is created.
The documentation shows how to link selected points in different plots (by using the same ColumnDataSource object), how to filter them, and how to use vbar, but not all of them together.
Any hint? Thank you very much in advance.

How do you get the range of the x-axis of a Plotly graph?

I'm trying to retrieve the range of the x-axis when you zoom in a plotly scatter plot, but when I tried to access it using:
figure['layout']['xaxis']['range']
it just returns 'None'.
This is the code that I am using to create the graph:
# self.plot contains the dataframe passed to the function to be plotted
self.plot = df
# Creates the plotly plot figure
self.fig = self.plot.iplot(asFigure=True,kind='scatter', xTitle='Date', yTitle='Temperature')
# Displays the plot
iplot(self.fig, show_link=False)
I'm using cufflinks to create the plot from a pandas DataFrame so I don't explicitly set the layout.xaxis.range to anything. Also I'm using a Jupyter Notebook to display the graph, if that helps at all. So is there any way of getting the range of the x-axis of the current view window of the plot? Thanks in advance!
That does not seem to be possible at the moment using python. There's a post on community.plot.ly that says:
Graph parameters don’t dynamically change with chart actions. However,
as you zoom, the plot does emit data regarding the new x-axis range,
you’re unable to to access this information directly in Python.
Instead you’d have to use javascript:
https://plot.ly/javascript/zoom-events/

Multiple charts in one figure in Bokeh

Is it possible in Bokeh to combine multiple high-level charts in one plot? For example Line chart with Scatter chart? Thanks.
Yes (as of 0.8.1), use hplot, vplot or gridplot from bokeh.charts See, for example:
https://github.com/bokeh/bokeh/blob/master/examples/charts/scatter.py#L43

Categories