@@ -147,7 +147,7 @@ def get_title(self, loc="center"):
147147 raise ValueError ("'%s' is not a valid location" % loc )
148148 return title .get_text ()
149149
150- def set_title (self , label , fontdict = None , loc = "center" , pad = None ,
150+ def set_title (self , label , fontdict = None , loc = None , pad = None ,
151151 ** kwargs ):
152152 """
153153 Set a title for the axes.
@@ -171,7 +171,7 @@ def set_title(self, label, fontdict=None, loc="center", pad=None,
171171 'horizontalalignment': loc}
172172
173173 loc : {'center', 'left', 'right'}, str, optional
174- Which title to set, defaults to 'center'
174+ Which title to set, defaults to rcParams['axes.titlelocation']
175175
176176 pad : float
177177 The offset of the title from the top of the axes, in points.
@@ -190,6 +190,9 @@ def set_title(self, label, fontdict=None, loc="center", pad=None,
190190 properties.
191191 """
192192 try :
193+ if loc is None :
194+ loc = rcParams ['axes.titlelocation' ]
195+
193196 title = {'left' : self ._left_title ,
194197 'center' : self .title ,
195198 'right' : self ._right_title }[loc .lower ()]
0 commit comments