why are the y-axis labels lost when specifying: ax.set_yticklabels(ax.get_yticklabels(), fontsize=16)
%pylab inline
import pandas as pd
import seaborn as sns; sns.set()
df = pd.DataFrame({'dt':['2020-01-01', '2020-01-02', '2020-01-03', '2020-01-04'], 'category':['a', 'b', 'a', 'b'], 'foo':[10, 15, 8, 13], 'bar':[12, 8, 5, 18]})
df['dt'] = pd.to_datetime(df['dt'])
plt.figure()
ax0 = plt.subplot(211)
ax = sns.lineplot(x='dt', y='foo', data=df, hue='category', ax=ax0)
ax.set_yticklabels(ax.get_yticklabels(), fontsize=16)
plt.show()
edit
plt.yticks(fontsize=16)
works just fine though. However, I must use theo object-oriented API as I use this in a more complex plot. Otherwise, plt
refers to the wrong axis.