Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/matplotlib/axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -2339,7 +2339,6 @@ def set_label_position(self, position):
position : {'left', 'right'}
"""
self.label.set_rotation_mode('anchor')
self.label.set_horizontalalignment('center')
self.label.set_verticalalignment(_api.check_getitem({
'left': 'bottom', 'right': 'top',
}, position=position))
Expand Down
10 changes: 10 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
image_comparison, check_figures_equal, remove_ticks_and_titles)
import matplotlib.colors as mcolors
import matplotlib.dates as mdates
from matplotlib.figure import Figure
import matplotlib.font_manager as mfont_manager
import matplotlib.markers as mmarkers
import matplotlib.patches as mpatches
Expand Down Expand Up @@ -6758,3 +6759,12 @@ def test_2dcolor_plot(fig_test, fig_ref):
axs[2].step([1, 2], [1, 2], c=color.reshape((1, -1)))
axs[3].hist(np.arange(10), color=color.reshape((1, -1)))
axs[4].bar(np.arange(10), np.arange(10), color=color.reshape((1, -1)))


@pytest.mark.parametrize('ha', ['left', 'center', 'right'])
def test_ylabel_ha_with_position(ha):
fig = Figure()
ax = fig.subplots()
ax.set_ylabel("test", y=1, ha=ha)
ax.yaxis.set_label_position("right")
assert ax.yaxis.get_label().get_ha() == ha