Why has seaborn/matplotlib filled below the line in this lineplot in my jupyter notebook?

房东的猫 提交于 2020-07-14 12:38:11

问题


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

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')

回答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


来源:https://stackoverflow.com/questions/53532529/why-has-seaborn-matplotlib-filled-below-the-line-in-this-lineplot-in-my-jupyter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!