1
- from __future__ import absolute_import , division , print_function
2
-
1
+ import itertools
3
2
import warnings
4
3
5
4
import numpy
@@ -14,14 +13,15 @@ def check_shared(axs, x_shared, y_shared):
14
13
x_shared and y_shared are n x n boolean matrices; entry (i, j) indicates
15
14
whether the x (or y) axes of subplots i and j should be shared.
16
15
"""
17
- shared = [axs [0 ]._shared_x_axes , axs [0 ]._shared_y_axes ]
18
- for (i1 , ax1 ), (i2 , ax2 ), (i3 , (name , shared )) in zip (
16
+ for (i1 , ax1 ), (i2 , ax2 ), (i3 , (name , shared )) in itertools .product (
19
17
enumerate (axs ),
20
18
enumerate (axs ),
21
19
enumerate (zip ("xy" , [x_shared , y_shared ]))):
22
20
if i2 <= i1 :
23
21
continue
24
- assert shared [i3 ].joined (ax1 , ax2 ) == shared [i1 , i2 ], \
22
+ assert \
23
+ (getattr (axs [0 ], "_shared_{}_axes" .format (name )).joined (ax1 , ax2 )
24
+ == shared [i1 , i2 ]), \
25
25
"axes %i and %i incorrectly %ssharing %s axis" % (
26
26
i1 , i2 , "not " if shared [i1 , i2 ] else "" , name )
27
27
@@ -30,7 +30,7 @@ def check_visible(axs, x_visible, y_visible):
30
30
def tostr (v ):
31
31
return "invisible" if v else "visible"
32
32
33
- for ( ax , vx , vy ) in zip (axs , x_visible , y_visible ):
33
+ for ax , vx , vy in zip (axs , x_visible , y_visible ):
34
34
for l in ax .get_xticklabels () + [ax .get_xaxis ().offsetText ]:
35
35
assert l .get_visible () == vx , \
36
36
"X axis was incorrectly %s" % (tostr (vx ))
0 commit comments