How do you plot a vertical line on a time series plot in Pandas?
matplotlib, pandas, python, seaborn, time-series
Solution
plt.axvline(x_position)
It takes the standard plot formatting options (`linestlye`, `color`, ect)
(doc)
If you have a reference to your `axes` object:
ax.axvline(x, color='k', linestyle='--')
Problem
- How do you plot a vertical line (`vlines`) in a Pandas series plot? - I am using Pandas to plot rolling means, etc., and would like to mark important positions with a vertical line. - Is it possible to use `vlines`, or something similar, to accomplish this? - In this case, the x axis is `datetime`.