I'm trying to change the font size of the tick lables on the y-axis using ax.set_yticklabels(labels=ax.get_yticklabels(), Fontsize=8)
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
y = np.linspace(0, 100)
x_1 = y**2
x_2 = y**2 - y
my_labels = ['x_1', 'x_2']
my_data = [x_1, x_2]
my_plot = ax.boxplot(my_data, whis = 1.5, labels=my_labels, showfliers=False, patch_artist=True)
ax.set_xticklabels(labels=my_labels, rotation = 45, Fontsize=12)
ax.set_yticklabels(labels=ax.get_yticklabels(), Fontsize=8)
my_plot['boxes'][0].set_facecolor('yellow')
my_plot['boxes'][1].set_facecolor('cyan')
plt.show()
This gives me,
As can be seen the y-axis labels are missing. If I comment out ax.set_yticklabels(labels=ax.get_yticklabels(), Fontsize=8)
I get,
So, how do I change the y-axis font size?