I am trying to fill between two lines using Bokeh. My two datasets contain sections of NaNs. The patch renders correctly for the last section of data, but fails for sections before any NaN blocks. The following example illustrates the problem:

from bokeh.plotting import figure, output_file, show

import numpy as np

p = figure(plot_width=400, plot_height=300)

mx = np.array(np.random.randint(20, 25, 30), dtype=float)

mx[7:11] = np.nan

mx[19:23] = np.nan

mn = mx-10

x = np.arange(0, len(mn))

wX = np.append(x, x[::-1])

wY = np.append(mx, mn[::-1])

p.patch(wX, wY)

show§

``

This produces the following figure:

I would like the first two parallel line sections to plot with a fill-between as the final section is plotting. Instead, these sections seem to be applying the patch just to the line segments themselves. I have a solution that creates individual patches by looping over each contiguous section of data, but it is too slow over many 100s of patches.

Any solutions??

This question is also posted to Stack Overflow here.