![]() ![]() It can create versatile, data-driven graphics and connect the full power of the entire Python data science stack to create rich, interactive visualizations. Green_line = ax.line(,, legend="green", color="green")Ĭallback = CustomJS. Currently I am using Python, Streamlit and Vega-Lite for the graph. Bokeh is an interactive data visualization library for Python, and other languages, that targets modern web browsers for presentation. Red_line = ax.line(,, legend="red", color="red") Span3 = Span(location=t, dimension='height', line_color=c) Span2 = Span(location=t, dimension='height', line_color=c) Span1 = Span(location=t, dimension='height', line_color=c) import numpy as npįrom bokeh.io import output_notebook, show In the following example, I use tags property to keep the Span objects to show/hide. ![]() Since Span doesn't have legend property, you need to create two dummy lines to show the legend. Clicking one color would hide all the lines of that color on all the plots. ![]() So, in this case, I would have a single legend that is shared in all 3 plots, and in this legend I would have 2 entries, one for red lines and one for green lines. For example x = np.arange(50)ĭata = np.random.rand(3, x.shape) *, , ] # Different scalesĪx = figure(plot_width=300, plot_height=300)īx = figure(x_range=ax.x_range, plot_width=300, plot_height=300)Ĭx = figure(x_range=ax.x_range, plot_width=300, plot_height=300)Īx.add_layout(Span(location=t, dimension='height', line_color=c))īx.add_layout(Span(location=t, dimension='height', line_color=c))Ĭx.add_layout(Span(location=t, dimension='height', line_color=c))īeside the fact that I would like to add the Span elements to be part of a single axis and make it shared, instead of adding them to each plot, I would like to create a legend for the Span objects and make them toggleable by color. See also a contour plot example in the bokeh gallery page Comparison to bokehīokeh-plot is a thin wrapper over the excellent bokeh library that cuts down the amount of boilerplate code.I am just starting with bokeh, and I would like to represent 3 datasets on 3 different plots, in a grid, such that all of them have some toggleable vertical lines.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |