简体   繁体   English

对于 seaborn 中相同的 x 轴值,不同的 plot

[英]different plot for same x-axis value in seaborn

I have a pandas dataframe, which looks like this:我有一个 pandas dataframe,它看起来像这样:

import seaborn as sns
import pandas as pd

d = {'a': [100, 125, 300, 520], 'b': [250, 270, 278, 248]}
df = pd.DataFrame(data=d, index=[25, 26, 26, 30])
             a         b
  25        100       250
  26        125       270
  26        300       278
  30        520       248

When I try to plot this dataframe with当我尝试 plot 这个 dataframe 时

df=sns.lineplot(data=df, dashes=False)

the values for 26 are averaged and a error bar shows up. 26 的值是平均的,并显示错误栏。 However I want the values for 26 plotted separately.但是我想单独绘制 26 的值。

That's what the estimator parameter does.这就是estimator参数的作用。 See the docs: https://seaborn.pydata.org/generated/seaborn.lineplot.html请参阅文档: https://seaborn.pydata.org/generated/seaborn.lineplot.html

sns.lineplot(data=df, dashes=False, estimator=None)

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM