Fill between multi_line


to produce my spiral char I use Mutiline

 multi_line([x_base,x_cas_sup,x_cas_inf],[y_base,y_cas_sup,y_cas_inf],color=["firebrick", "navy","navy"])

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

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(['xs'])-1):
    #get the upper line coords
    upperX =['xs'][i]
    upperY =['xs'][i]
    #get the lower line coords
    lowerX =['xs'][i+1]
    lowerY =['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

Then pass those patch geoms to a Patches glyph.

1 Like

thanks for you solution it helps me a lot ! :pray:
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.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)

By the way Aqua web site is very nice :muscle:


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.