简体   繁体   中英

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

The Python code to create the plot used is below. This creates subplots based on "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.

You need to create the line in all generated plots.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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