简体   繁体   English

我们如何使用Python seaborn relplot在所有子图上绘制一条垂直线?

[英]How can we plot a vertical line on all subplots using Python seaborn relplot?

The Python code to create the plot used is below. 下面是创建所用绘图的Python代码。 This creates subplots based on "variable" : 这将基于"variable"创建子图:

s=sb.relplot(x="timestamp",y="value",hue="variable",row="variable",
kind="line",facet_kws=dict(sharey=False),height=0.8, aspect=7,data=e)

plt.axvline(flip_timex)

s.fig.autofmt_xdate()

plt.show()

I need to add a vertical line (on a fixed date) on all the subplots generated. 我需要在所有生成的子图中添加一条垂直线(按固定日期)。

plt.axvline(flip_timex) adds a vertical line only on one subplot. plt.axvline(flip_timex)仅在一个子图上添加一条垂直线。

You need to create the line in all generated plots. 您需要在所有生成的绘图中创建线。

grid = seaborn.relplot(...)
for ax in grid.axes.flat:
    ax.axvline(...)

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

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