3

I can draw 3 lines this way:

sns.lineplot(x="week", y="mean",    data=df)
sns.lineplot(x="week", y="min",     data=df)
sns.lineplot(x="week", y="max",     data=df)

So we have here min max and average value, they have precomputed before:

enter image description here

I want want fulfill with color between min and max, it have to look this way: enter image description here

How to do that?

Rocketq
  • 5,423
  • 23
  • 75
  • 126

1 Answers1

2

matplotlib

You are looking for matplotlib.pyplot.fill_between

ax.fill_between(x, min, max)

see this link for a full example

https://matplotlib.org/2.0.1/examples/pylab_examples/fill_between_demo.html

Link to seaborn

In the specific example of seaborn you need to first call the facetgrid function to populate the facetgrid with a blank plot.

Only then you can add lines in a matplotlib way whilst still using pretty seaborn formatting

See right at the bottom of the seaborn.FacetGrid docs and you will find an Attribute ax documented. In some versions this might also be axes

Alexander McFarlane
  • 10,643
  • 9
  • 59
  • 100