@@ -960,7 +960,7 @@ def add_axes(self, *args, **kwargs):
960960 # check that an axes of this type doesn't already exist, if it
961961 # does, set it as active and return it
962962 ax = self ._axstack .get (key )
963- if ax is not None and isinstance (ax , projection_class ):
963+ if isinstance (ax , projection_class ):
964964 self .sca (ax )
965965 return ax
966966
@@ -1862,12 +1862,10 @@ def subplots_adjust(self, *args, **kwargs):
18621862 for ax in self .axes :
18631863 if not isinstance (ax , SubplotBase ):
18641864 # Check if sharing a subplots axis
1865- if (ax ._sharex is not None and
1866- isinstance (ax ._sharex , SubplotBase )):
1865+ if isinstance (ax ._sharex , SubplotBase ):
18671866 ax ._sharex .update_params ()
18681867 ax .set_position (ax ._sharex .figbox )
1869- elif (ax ._sharey is not None and
1870- isinstance (ax ._sharey , SubplotBase )):
1868+ elif isinstance (ax ._sharey , SubplotBase ):
18711869 ax ._sharey .update_params ()
18721870 ax .set_position (ax ._sharey .figbox )
18731871 else :
@@ -1974,8 +1972,8 @@ def get_tightbbox(self, renderer):
19741972
19751973 return bbox_inches
19761974
1977- def tight_layout (self , renderer = None , pad = 1.08 , h_pad = None ,
1978- w_pad = None , rect = None ):
1975+ def tight_layout (self , renderer = None , pad = 1.08 , h_pad = None , w_pad = None ,
1976+ rect = None ):
19791977 """
19801978 Adjust subplot parameters to give specified padding.
19811979
@@ -1993,23 +1991,20 @@ def tight_layout(self, renderer=None, pad=1.08, h_pad=None,
19931991 labels) will fit into. Default is (0, 0, 1, 1).
19941992 """
19951993
1996- from .tight_layout import (get_renderer , get_tight_layout_figure ,
1997- get_subplotspec_list )
1994+ from .tight_layout import (
1995+ get_renderer , get_subplotspec_list , get_tight_layout_figure )
19981996
19991997 subplotspec_list = get_subplotspec_list (self .axes )
20001998 if None in subplotspec_list :
2001- warnings .warn ("This figure includes Axes that are not "
2002- "compatible with tight_layout, so its "
2003- "results might be incorrect." )
1999+ warnings .warn ("This figure includes Axes that are not compatible "
2000+ "with tight_layout, so results might be incorrect." )
20042001
20052002 if renderer is None :
20062003 renderer = get_renderer (self )
20072004
2008- kwargs = get_tight_layout_figure (self , self .axes , subplotspec_list ,
2009- renderer ,
2010- pad = pad , h_pad = h_pad , w_pad = w_pad ,
2011- rect = rect )
2012-
2005+ kwargs = get_tight_layout_figure (
2006+ self , self .axes , subplotspec_list , renderer ,
2007+ pad = pad , h_pad = h_pad , w_pad = w_pad , rect = rect )
20132008 self .subplots_adjust (** kwargs )
20142009
20152010
0 commit comments