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

Skip to content

Commit c28f1f4

Browse files
committed
Add test for not auto moving.
1 parent 92633f9 commit c28f1f4

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed
Binary file not shown.

lib/matplotlib/tests/baseline_images/test_axes/titletwiny.svg

Lines changed: 1 addition & 1 deletion
Loading

lib/matplotlib/tests/test_axes.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5220,6 +5220,21 @@ def test_titletwiny():
52205220
ax.set_title('Title')
52215221

52225222

5223+
def test_titlesetpos():
5224+
# Test that title stays put if we set it manually
5225+
fig, ax = plt.subplots()
5226+
fig.subplots_adjust(top=0.8)
5227+
ax2 = ax.twiny()
5228+
ax.set_xlabel('Xlabel')
5229+
ax2.set_xlabel('Xlabel2')
5230+
ax.set_title('Title')
5231+
pos = (0.5, 1.11)
5232+
ax.title.set_position(pos)
5233+
renderer = fig.canvas.get_renderer()
5234+
ax._update_title_position(renderer)
5235+
assert ax.title.get_position() == pos
5236+
5237+
52235238
def test_offset_label_color():
52245239
# Tests issue 6440
52255240
fig = plt.figure()

0 commit comments

Comments
 (0)