Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit95d2158

Browse files
committed
FIX: do not reset ylabel ha when changing position
closes#18427
1 parent5b835ee commit95d2158

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

‎lib/matplotlib/axis.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2339,8 +2339,7 @@ def set_label_position(self, position):
23392339
position : {'left', 'right'}
23402340
"""
23412341
self.label.set_rotation_mode('anchor')
2342-
self.label.set_horizontalalignment('center')
2343-
self.label.set_verticalalignment(_api.check_getitem({
2342+
self.label.set_verticalalignment(_api._check_getitem({
23442343
'left':'bottom','right':'top',
23452344
},position=position))
23462345
self.label_position=position

‎lib/matplotlib/tests/test_axes.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
image_comparison,check_figures_equal,remove_ticks_and_titles)
2424
importmatplotlib.colorsasmcolors
2525
importmatplotlib.datesasmdates
26+
frommatplotlib.figureimportFigure
2627
importmatplotlib.font_managerasmfont_manager
2728
importmatplotlib.markersasmmarkers
2829
importmatplotlib.patchesasmpatches
@@ -6758,3 +6759,13 @@ def test_2dcolor_plot(fig_test, fig_ref):
67586759
axs[2].step([1,2], [1,2],c=color.reshape((1,-1)))
67596760
axs[3].hist(np.arange(10),color=color.reshape((1,-1)))
67606761
axs[4].bar(np.arange(10),np.arange(10),color=color.reshape((1,-1)))
6762+
6763+
6764+
@pytest.mark.parametrize('ha', ['left','center','right'])
6765+
deftest_ylabel_ha_with_position(ha):
6766+
6767+
fig=Figure()
6768+
ax=fig.subplots()
6769+
ax.set_ylabel("test",y=1,ha=ha)
6770+
ax.yaxis.set_label_position("right")
6771+
assertax.yaxis.get_label().get_ha()==ha

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp