1010 object that can be used to set the axes_locator of the axes.
1111"""
1212
13- import matplotlib .transforms as mtransforms
1413from matplotlib import cbook
1514from matplotlib .axes import SubplotBase
15+ from matplotlib .gridspec import SubplotSpec , GridSpec
16+ import matplotlib .transforms as mtransforms
1617from . import axes_size as Size
1718
1819
@@ -347,9 +348,6 @@ def get_subplotspec(self):
347348 return None
348349
349350
350- from matplotlib .gridspec import SubplotSpec , GridSpec
351-
352-
353351class SubplotDivider (Divider ):
354352 """
355353 The Divider class whose rectangle area is specified as a subplot geometry.
@@ -539,32 +537,26 @@ def new_horizontal(self, size, pad=None, pack_start=False, **kwargs):
539537 instance of the given class. Otherwise, the same class of the
540538 main axes will be used.
541539 """
542-
543540 if pad :
544541 if not isinstance (pad , Size ._Base ):
545- pad = Size .from_any (pad ,
546- fraction_ref = self ._xref )
542+ pad = Size .from_any (pad , fraction_ref = self ._xref )
547543 if pack_start :
548544 self ._horizontal .insert (0 , pad )
549545 self ._xrefindex += 1
550546 else :
551547 self ._horizontal .append (pad )
552-
553548 if not isinstance (size , Size ._Base ):
554- size = Size .from_any (size ,
555- fraction_ref = self ._xref )
556-
549+ size = Size .from_any (size , fraction_ref = self ._xref )
557550 if pack_start :
558551 self ._horizontal .insert (0 , size )
559552 self ._xrefindex += 1
560553 locator = self .new_locator (nx = 0 , ny = self ._yrefindex )
561554 else :
562555 self ._horizontal .append (size )
563- locator = self .new_locator (nx = len ( self . _horizontal ) - 1 , ny = self . _yrefindex )
564-
556+ locator = self .new_locator (
557+ nx = len ( self . _horizontal ) - 1 , ny = self . _yrefindex )
565558 ax = self ._get_new_axes (** kwargs )
566559 ax .set_axes_locator (locator )
567-
568560 return ax
569561
570562 def new_vertical (self , size , pad = None , pack_start = False , ** kwargs ):
@@ -589,32 +581,25 @@ def new_vertical(self, size, pad=None, pack_start=False, **kwargs):
589581 instance of the given class. Otherwise, the same class of the
590582 main axes will be used.
591583 """
592-
593584 if pad :
594585 if not isinstance (pad , Size ._Base ):
595- pad = Size .from_any (pad ,
596- fraction_ref = self ._yref )
586+ pad = Size .from_any (pad , fraction_ref = self ._yref )
597587 if pack_start :
598588 self ._vertical .insert (0 , pad )
599589 self ._yrefindex += 1
600590 else :
601591 self ._vertical .append (pad )
602-
603592 if not isinstance (size , Size ._Base ):
604- size = Size .from_any (size ,
605- fraction_ref = self ._yref )
606-
593+ size = Size .from_any (size , fraction_ref = self ._yref )
607594 if pack_start :
608595 self ._vertical .insert (0 , size )
609596 self ._yrefindex += 1
610597 locator = self .new_locator (nx = self ._xrefindex , ny = 0 )
611598 else :
612599 self ._vertical .append (size )
613600 locator = self .new_locator (nx = self ._xrefindex , ny = len (self ._vertical )- 1 )
614-
615601 ax = self ._get_new_axes (** kwargs )
616602 ax .set_axes_locator (locator )
617-
618603 return ax
619604
620605 def append_axes (self , position , size , pad = None , add_to_figure = True ,
0 commit comments