简体   繁体   English

如何将 seaborn regplot scattplot 更改为 lineplot?

[英]How to change seaborn regplot scattplot to lineplot?

I am trying to change the scatterplot to be a lineplot I have attempted to try using plot.lines[0].set_linestyle("-") however this only affects the regression line which is already a lineplot.我试图将散点图更改为我尝试使用plot.lines[0].set_linestyle("-")的线图,但这只会影响已经是线图的回归线。

I understand if I used sns.lineplot their is a setting in their to turn on regression however I am trying to do this using regplot.我知道如果我使用 sns.lineplot 它们是他们打开回归的设置,但是我正在尝试使用 regplot 来做到这一点。

df = pd.DataFrame({"x": [1, 2, 3, 4, 5, 6], "y": [10, 30, 60, 90, 60, 30]})

plot = sns.regplot(x="x", y="y", data=df, ci=65)

plt.show()

The reason I want to change the scatterplot to a lineplot is beacouse its hard to see whats going on with large datasets other whys.我想将散点图更改为线图的原因是因为很难看到大型数据集发生了什么其他原因。

To clarify I am trying display a lineplot instead of a scatterplot for the original data.为了澄清我正在尝试显示原始数据的线图而不是散点图。

This looks a bit odd, but I'm guessing it's what you want?这看起来有点奇怪,但我猜这就是你想要的?

import seaborn as sns
df = pd.DataFrame({"x": [1, 2, 3, 4, 5, 6], "y": [10, 30, 60, 90, 60, 30]})
sns.regplot(x="x", y="y", data=df, ci=65,scatter=False)
sns.lineplot(x="x", y="y", data=df)

在此处输入图片说明

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

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