@@ -4335,49 +4335,37 @@ def unshare_axes(self, axes=None):
4335
4335
self .unshare_x_axes (axes )
4336
4336
self .unshare_y_axes (axes )
4337
4337
4338
- def _share_axes (self , axes , shared_axes , symmetric = True , transitive = True ):
4339
- if symmetric :
4340
- sharedA = getattr (self , "_shared_{}_axes" .format (shared_axes ))
4341
- sharedB = getattr (axes , "_shared_{}_axes" .format (shared_axes ))
4342
-
4343
- # Adding to main share list
4344
- sharedA .add (axes )
4345
- sharedB .add (self )
4338
+ @staticmethod
4339
+ def _share_axes_symmetric (A , B , shared_axes ):
4340
+ """Share A -> B, and B -> A"""
4341
+ _AxesBase ._share_axes_asymmetric (A , B , shared_axes )
4342
+ _AxesBase ._share_axes_asymmetric (B , A , shared_axes )
4346
4343
4347
- # Adding to all share list
4348
- sharedA = getattr (self , "_shared_{}_inv_axes" .format (shared_axes ))
4349
- sharedB = getattr (axes , "_shared_{}_inv_axes" .format (shared_axes ))
4344
+ @staticmethod
4345
+ def _share_axes_asymmetric (A , B , shared_axes ):
4346
+ """Share A -> B"""
4347
+ getattr (A , "_shared_{}_axes" .format (shared_axes )).add (B )
4348
+ getattr (B , "_shared_{}_inv_axes" .format (shared_axes )).add (A )
4350
4349
4351
- sharedA .add (axes )
4352
- sharedB .add (self )
4350
+ def _share_axes (self , axes , shared_axes , symmetric = True , transitive = True ):
4351
+ if symmetric :
4352
+ self ._share_axes_symmetric (self , axes , shared_axes )
4353
4353
else :
4354
- sharedA = getattr (self , "_shared_{}_axes" .format (shared_axes ))
4355
- sharedB = getattr (axes , "_shared_{}_inv_axes" .format (shared_axes ))
4356
-
4357
- sharedA .add (axes )
4358
- sharedB .add (self )
4354
+ self ._share_axes_asymmetric (self , axes , shared_axes )
4359
4355
4360
4356
if transitive :
4361
4357
sharedA = getattr (self , "_shared_{}_axes" .format (shared_axes ))
4362
4358
sharedB = getattr (axes , "_shared_{}_axes" .format (shared_axes ))
4363
4359
4364
4360
sharedDiffBA = sharedB - sharedA
4365
4361
sharedDiffAB = sharedA - sharedB
4366
- # A share all that is in B.
4367
- sharedA |= sharedB
4368
4362
4369
4363
for ax in sharedDiffBA :
4370
- shared = getattr (ax , "_shared_{}_inv_axes" .format (shared_axes ))
4371
- shared .add (self )
4364
+ self ._share_axes_asymmetric (self , ax , shared_axes )
4372
4365
4373
- # B share all that is in A
4374
4366
if symmetric :
4375
- sharedB |= sharedA
4376
-
4377
4367
for ax in sharedDiffAB :
4378
- shared = getattr (ax ,
4379
- "_shared_{}_inv_axes" .format (shared_axes ))
4380
- shared .add (axes )
4368
+ self ._share_axes_asymmetric (axes , ax , shared_axes )
4381
4369
4382
4370
def share_x_axes (self , axes , symmetric = True , transitive = True ):
4383
4371
"""
0 commit comments