如何在两个图中添加ylabel,当我添加plt.ylabel(“ Frequency”)时,它仅在我的红色图中呈现
这是我的代码:
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
values1 = np.array([1, 2, 2, 5, 3, 4, 7, 4, 3, 3])
values2 = np.array([1, 4, 4, 6, 3, 1, 7, 1, 7, 6])
f, (ax1, ax2) = plt.subplots(1, 2, sharex=True)
sns.distplot(values1, ax=ax1, kde=False, color='green', label="New_Formula")
sns.distplot(values2, ax=ax2, kde=False, color='red', label="Old_Formula")
f.legend()
plt.ylabel("Frequency")
plt.show()