Now I would to colorize between my multiline, I am looking for the analog of fill_between from Matplotlib.
Any idea ?
By advance thank you
cheers,
Olivier
I wrote a routine to do this on the JS side for my XS tool (Aqua Insight Inc. - Hydrographs) by stitching together a series of patch geometries based on the coords of each array of line coords and the array of line coords below it (so iterating through the length of the multiline source - 1). You just have to ensure your multiline source is ordered the way you want beforehand.
Pythony pseudo code wise, it’s along the lines of:
patch_geoms = {'xs':[],'ys':[]}
for i in range(len(multiline_src.data['xs'])-1):
#get the upper line coords
upperX = multiline_src.data['xs'][i]
upperY = multiline_src.data['xs'][i]
#get the lower line coords
lowerX = multiline_src.data['xs'][i+1]
lowerY = multiline_src.data['xs'][i+1]
#x geom for the patch will be the upperX + the lowerX reversed (kinda stitching together "clockwise)
geomX = upperX+lower[X][::-1]
#same idea for y geom
geomY = upperY+lower[Y][::-1]
#add this to patch geoms
patch_geoms['xs'].append(geomX)
patch_geoms['ys'].append(geomY)
@gmerritt123
thanks for you solution it helps me a lot !
Here my minimal solution
standardfig.multi_line([x_base,x_cas_sup,x_cas_inf],[y_base,y_cas_sup,y_cas_inf],color=["firebrick", "navy","navy"])
xcol,ycol=[],[]
[ xcol.append([i,j]) for i,j in zip(x_cas_inf,x_cas_sup)]
[ ycol.append([i,j]) for i,j in zip(y_cas_inf,y_cas_sup)]
standardfig.patches(xcol,ycol,color='blue',fill_alpha = 0.5)