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

Commitc723466

Browse files
author
productivememberofsociety666
committed
Extended tests (visibility changes).
1 parent585ce3e commitc723466

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

‎lib/mpl_toolkits/tests/test_axes_grid1.py

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
frommatplotlib.externalsimportsix
55

6+
importmatplotlib
67
importmatplotlib.pyplotasplt
78
frommatplotlib.testing.decoratorsimportimage_comparison
89
frommpl_toolkits.axes_grid1importmake_axes_locatable,host_subplot
@@ -55,13 +56,29 @@ def test_divider_append_axes():
5556
@image_comparison(baseline_images=['twin_axes_empty_and_removed'],
5657
extensions=["png"])
5758
deftest_twin_axes_empty_and_removed():
58-
a= ["twinx","twiny","twin" ]
59-
b= [None,"remove" ]
60-
fori, (twin,op)inenumerate(product(a,b),1):
61-
h=host_subplot(len(a),len(b),i)
62-
t=getattr(h,twin)()
63-
getattr(t,op)()ifopelseNone
64-
h.text(0.5,0.5,twin+ (" & {0}".format(op)ifopelse""),
59+
# Purely cosmetic font changes (avoid overlap)
60+
matplotlib.rcParams.update({"font.size":8})
61+
matplotlib.rcParams.update({"xtick.labelsize":8})
62+
matplotlib.rcParams.update({"ytick.labelsize":8})
63+
generators= ["twinx","twiny","twin" ]
64+
modifiers= ["","host invisible","twin removed","twin invisible",
65+
"twin removed\nhost invisible" ]
66+
# Unmodified host subplot at the beginning for reference
67+
h=host_subplot(len(modifiers)+1,len(generators),2)
68+
h.text(0.5,0.5,"host_subplot",horizontalalignment="center",
69+
verticalalignment="center")
70+
# Host subplots with various modifications (twin*, visibility) applied
71+
fori, (mod,gen)inenumerate(product(modifiers,generators),
72+
len(generators)+1):
73+
h=host_subplot(len(modifiers)+1,len(generators),i)
74+
t=getattr(h,gen)()
75+
if"twin invisible"inmod:
76+
t.axis[:].set_visible(False)
77+
if"twin removed"inmod:
78+
t.remove()
79+
if"host invisible"inmod:
80+
h.axis[:].set_visible(False)
81+
h.text(0.5,0.5,gen+ ("\n"+modifmodelse""),
6582
horizontalalignment="center",verticalalignment="center")
6683
plt.subplots_adjust(wspace=0.5,hspace=1)
6784

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp