1- from __future__ import absolute_import , division , print_function
2-
1+ import itertools
32import warnings
43
54import numpy
@@ -14,14 +13,15 @@ def check_shared(axs, x_shared, y_shared):
1413 x_shared and y_shared are n x n boolean matrices; entry (i, j) indicates
1514 whether the x (or y) axes of subplots i and j should be shared.
1615 """
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 (
1917 enumerate (axs ),
2018 enumerate (axs ),
2119 enumerate (zip ("xy" , [x_shared , y_shared ]))):
2220 if i2 <= i1 :
2321 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 ]), \
2525 "axes %i and %i incorrectly %ssharing %s axis" % (
2626 i1 , i2 , "not " if shared [i1 , i2 ] else "" , name )
2727
@@ -30,7 +30,7 @@ def check_visible(axs, x_visible, y_visible):
3030 def tostr (v ):
3131 return "invisible" if v else "visible"
3232
33- for ( ax , vx , vy ) in zip (axs , x_visible , y_visible ):
33+ for ax , vx , vy in zip (axs , x_visible , y_visible ):
3434 for l in ax .get_xticklabels () + [ax .get_xaxis ().offsetText ]:
3535 assert l .get_visible () == vx , \
3636 "X axis was incorrectly %s" % (tostr (vx ))
0 commit comments