'Why has seaborn/matplotlib filled below the line in this lineplot

I don't know why my plot looks like this:

lineplot with unwanted fill below line

I only want to display lines with no fill. Code below. Note this also happens if I run in Spyder or cmd.

import matplotlib.pyplot as plt
import seaborn as sns
df_ard= pd.read_csv(pathx, parse_dates=['Date'] )


plt.figure(figsize=(15,8))

sns.lineplot(x="Date", y='As',
             hue="Location",
             data=df_ard,
             palette='bright')


Solution 1:[1]

This is an educated guess, since you don't provide your data (see Minimal, Complete, and Verifiable example), but I believe the shading comes from the fact that you have several y-values for the same x-value.

If you look at the documentation for sns.lineplot(), you'll read:

By default, the plot aggregates over multiple y values at each value of x and shows an estimate of the central tendency and a confidence interval for that estimate.

There are several options to remove the shading:

  • if you want to continue aggregating the data, but remove the shading, use ci=None
  • if you want to not aggregate the data, then use estimator=None

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Diziet Asahi