What else can we do with the fill_between function?


#1

Question

In the context of this exercise, what else can we do with the fill_between function?

Answer

In addition to drawing lines with shaded error as shown in this exercise, we can use the fill_between function to do several different things.

One is drawing multiple lines with shaded error on the same graph, so we can see more information or compare different plots.

Another thing we can do is draw the lines directly on top of other lines, where the top of one plot is the bottom of another. This is somewhat similar to the stacked bar chart.

We can also fill in areas where plots differ, for instance like the following.
overlapping

In addition, you can also use fill_between to show the area under a curve, by simply setting all the bottom bounds to 0’s.