Is there a way to have Bokeh plot data that has gaps in it? See the below screenshot from a Excel plot for an example. I tried using None values, but it just plotted zero values.
x_data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y_data = [4, 1, 2, 3, , , , 4, 4, 5]
You can use nan
(here I've used np.nan
, after import numpy as np
, but float("nan")
would work as well):
>>> y_data = [4, 1, 2, 3, np.nan, np.nan, np.nan, 4, 4, 5]
>>> x_data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>> p1 = figure(plot_width=600, plot_height=400)
>>> p1.line(x_data, y_data, size=12, color="blue")
gives
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With