import seaborn as sns
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
labels1 = ['A','B','C','D']
labels2 = ['E','F','G','H']
fig, ax = plt.subplots()
df = pd.DataFrame(np.random.random(size=(10,4)), columns=('A','B','C','D'))
sns.stripplot(data=df, orient='h', ax=ax)
ax2 = ax.twinx()
ax2.set(yticks=ax.get_yticks(), yticklabels=labels2);
I would like to produce some labels on a secondary y-axis that line up with the y-axis ticks of a stripplot on the primary y-axis. I would like E to be at the same height as D, F with C, etc.
I have tried some different methods to align the ticks but having no luck.
Any other suggestions for how to add these labels helpfully accepted.