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

Commit6c8e5d5

Browse files
committed
Add unit test for align_titles
1 parent497e1cf commit6c8e5d5

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

‎lib/matplotlib/tests/test_figure.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,32 @@ def test_align_labels():
6666
fig.align_labels()
6767

6868

69+
@image_comparison(['figure_align_titles_tight.png',
70+
'figure_align_titles_constrained.png'],
71+
tol=0ifplatform.machine()=='x86_64'else0.01,
72+
style='mpl20')
73+
deftest_align_titles():
74+
forlayoutin ['tight','constrained']:
75+
fig,axs=plt.subplots(1,2,layout=layout,width_ratios=[2,1])
76+
77+
ax=axs[0]
78+
ax.plot(np.arange(0,1e6,1000))
79+
ax.set_title('Title0 left',loc='left')
80+
ax.set_title('Title0 center',loc='center')
81+
ax.set_title('Title0 right',loc='right')
82+
83+
ax=axs[1]
84+
ax.plot(np.arange(0,1e4,100))
85+
ax.set_title('Title1')
86+
ax.set_xlabel('Xlabel0')
87+
ax.xaxis.set_label_position("top")
88+
ax.xaxis.tick_top()
89+
fortickinax.get_xticklabels():
90+
tick.set_rotation(90)
91+
92+
fig.align_titles()
93+
94+
6995
deftest_align_labels_stray_axes():
7096
fig,axs=plt.subplots(2,2)
7197
fornn,axinenumerate(axs.flat):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp