There was an error while loading. Please reload this page.
2 parents 571a787 + ad7007b commit 2486ba2Copy full SHA for 2486ba2
2 files changed
lib/matplotlib/axis.py
@@ -2339,7 +2339,6 @@ def set_label_position(self, position):
2339
position : {'left', 'right'}
2340
"""
2341
self.label.set_rotation_mode('anchor')
2342
- self.label.set_horizontalalignment('center')
2343
self.label.set_verticalalignment(_api.check_getitem({
2344
'left': 'bottom', 'right': 'top',
2345
}, position=position))
lib/matplotlib/tests/test_axes.py
@@ -23,6 +23,7 @@
23
image_comparison, check_figures_equal, remove_ticks_and_titles)
24
import matplotlib.colors as mcolors
25
import matplotlib.dates as mdates
26
+from matplotlib.figure import Figure
27
import matplotlib.font_manager as mfont_manager
28
import matplotlib.markers as mmarkers
29
import matplotlib.patches as mpatches
@@ -6774,3 +6775,12 @@ def test_2dcolor_plot(fig_test, fig_ref):
6774
6775
axs[2].step([1, 2], [1, 2], c=color.reshape((1, -1)))
6776
axs[3].hist(np.arange(10), color=color.reshape((1, -1)))
6777
axs[4].bar(np.arange(10), np.arange(10), color=color.reshape((1, -1)))
6778
+
6779
6780
+@pytest.mark.parametrize('ha', ['left', 'center', 'right'])
6781
+def test_ylabel_ha_with_position(ha):
6782
+ fig = Figure()
6783
+ ax = fig.subplots()
6784
+ ax.set_ylabel("test", y=1, ha=ha)
6785
+ ax.yaxis.set_label_position("right")
6786
+ assert ax.yaxis.get_label().get_ha() == ha
0 commit comments