@@ -960,7 +960,7 @@ def add_axes(self, *args, **kwargs):
960
960
# check that an axes of this type doesn't already exist, if it
961
961
# does, set it as active and return it
962
962
ax = self ._axstack .get (key )
963
- if ax is not None and isinstance (ax , projection_class ):
963
+ if isinstance (ax , projection_class ):
964
964
self .sca (ax )
965
965
return ax
966
966
@@ -1862,12 +1862,10 @@ def subplots_adjust(self, *args, **kwargs):
1862
1862
for ax in self .axes :
1863
1863
if not isinstance (ax , SubplotBase ):
1864
1864
# 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 ):
1867
1866
ax ._sharex .update_params ()
1868
1867
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 ):
1871
1869
ax ._sharey .update_params ()
1872
1870
ax .set_position (ax ._sharey .figbox )
1873
1871
else :
@@ -1974,8 +1972,8 @@ def get_tightbbox(self, renderer):
1974
1972
1975
1973
return bbox_inches
1976
1974
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 ):
1979
1977
"""
1980
1978
Adjust subplot parameters to give specified padding.
1981
1979
@@ -1993,23 +1991,20 @@ def tight_layout(self, renderer=None, pad=1.08, h_pad=None,
1993
1991
labels) will fit into. Default is (0, 0, 1, 1).
1994
1992
"""
1995
1993
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 )
1998
1996
1999
1997
subplotspec_list = get_subplotspec_list (self .axes )
2000
1998
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." )
2004
2001
2005
2002
if renderer is None :
2006
2003
renderer = get_renderer (self )
2007
2004
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 )
2013
2008
self .subplots_adjust (** kwargs )
2014
2009
2015
2010
0 commit comments