If I had simple integer x-axis, I could use plt.axvline(value) to get vertical
lines, but I am wondering how to get vertical dashed lines when we have string x-axis labels.
setup
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
np.random.seed(123)
x = np.random.normal(0,1,100)
xx = pd.cut(x,20).to_numpy().astype(str)
yy = np.random.normal(0,1,100)
plt.plot(xx,yy,'o')
plt.xticks(rotation=90)
plt.grid(True)
plt.show()
Required
- Every other vertical lines in grid plot to be dashed and colored.


