[英]How do I increase the line thickness of my Seaborn Line
I have a few seaborn lineplots and I can't figure out how to increase the width of my lines.我有一些 seaborn 线图,我不知道如何增加线的宽度。
Here is my code这是我的代码
#graph 1
sns.lineplot(x="date", y="nps", data=df_nps, ax=ax1, label="NPS", color='#0550D0')
sns.lineplot(x="date", y="ema28", data=df_nps, ax=ax1, label="EMA28", color='#7DF8F3')
sns.lineplot(x="date", y="ema7", data=df_nps, ax=ax1, label="EMA7", color='orange')
#graph 2
dfz_nps_lineplot = sns.lineplot(x="date", y="nps", data=dfz_nps, ax=ax2, label="NPS", color='#0550D0')
dfz_nps_lineplot = sns.lineplot(x="date", y="ema28", data=dfz_nps, ax=ax2, label="EMA28", color='#7DF8F3')
dfz_nps_lineplot = sns.lineplot(x="date", y="ema7", data=dfz_nps, ax=ax2, label="EMA7", color='orange')
#graph3
dfp_nps_lineplot = sns.lineplot(x="date", y="nps", data=dfp_nps, ax=ax3, label="NPS", color='#0550D0')
dfp_nps_lineplot = sns.lineplot(x="date", y="ema28", data=dfp_nps, ax=ax3, label="EMA28", color='#7DF8F3')
dfp_nps_lineplot = sns.lineplot(x="date", y="ema7", data=dfp_nps, ax=ax3, label="EMA7", color='orange')
# formatting
plt.show()
This is what my lineplots look like right now.这就是我的线图现在的样子。
https://gyazo.com/1aecfef9e71bfc9d6c0b5f603db93bd1 https://gyazo.com/1aecfef9e71bfc9d6c0b5f603db93bd1
As you can see from seaborn.lineplot documentation, the function accepts matplotlib.axes.Axes.plot() arguments, which means you can pass the same arguments you can to matplotlib function in this documentation . As you can see from seaborn.lineplot documentation, the function accepts matplotlib.axes.Axes.plot() arguments, which means you can pass the same arguments you can to matplotlib function in this documentation .
If you want to simply adjust the width of your lineplots I find this the easiest: pass an argument linewidth = your_desired_line_width_in_float
, for example, linewidth = 1.5
in your sns.lineplot()
functions.如果您想简单地调整线图的宽度,我发现这是最简单的:在您的sns.lineplot()
函数中传递一个参数linewidth = your_desired_line_width_in_float
,例如linewidth = 1.5
。
You can find additional possible arguments in the documentations linked.您可以在链接的文档中找到其他可能的 arguments。
Example output on random data:随机数据上的示例 output:
seaborn.lineplot() without linewdith argument provided seaborn.lineplot() 没有提供 linewdith 参数
seaborn.lineplot() with linewidth = 3 seaborn.lineplot() 线宽 = 3
You need to specify the linewidth parameter = desired width你需要指定linewidth参数=期望的宽度
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.