MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _suplabels

Method _suplabels

lib/matplotlib/figure.py:310–384  ·  view source on GitHub ↗

Add a centered %(name)s to the figure. Parameters ---------- t : str The %(name)s text. x : float, default: %(x0)s The x location of the text in figure coordinates. y : float, default: %(y0)s The y location of the

(self, t, info, **kwargs)

Source from the content-addressed store, hash-verified

308 return self.bbox
309
310 def _suplabels(self, t, info, **kwargs):
311 """
312 Add a centered %(name)s to the figure.
313
314 Parameters
315 ----------
316 t : str
317 The %(name)s text.
318 x : float, default: %(x0)s
319 The x location of the text in figure coordinates.
320 y : float, default: %(y0)s
321 The y location of the text in figure coordinates.
322 horizontalalignment, ha : {'center', 'left', 'right'}, default: %(ha)s
323 The horizontal alignment of the text relative to (*x*, *y*).
324 verticalalignment, va : {'top', 'center', 'bottom', 'baseline'}, \
325default: %(va)s
326 The vertical alignment of the text relative to (*x*, *y*).
327 fontsize, size : default: :rc:`figure.%(rc)ssize`
328 The font size of the text. See `.Text.set_size` for possible
329 values.
330 fontweight, weight : default: :rc:`figure.%(rc)sweight`
331 The font weight of the text. See `.Text.set_weight` for possible
332 values.
333
334 Returns
335 -------
336 text
337 The `.Text` instance of the %(name)s.
338
339 Other Parameters
340 ----------------
341 fontproperties : None or dict, optional
342 A dict of font properties. If *fontproperties* is given the
343 default values for font size and weight are taken from the
344 `.FontProperties` defaults. :rc:`figure.%(rc)ssize` and
345 :rc:`figure.%(rc)sweight` are ignored in this case.
346
347 **kwargs
348 Additional kwargs are `matplotlib.text.Text` properties.
349 """
350
351 x = kwargs.pop('x', None)
352 y = kwargs.pop('y', None)
353 if info['name'] in ['_supxlabel', '_suptitle']:
354 autopos = y is None
355 elif info['name'] == '_supylabel':
356 autopos = x is None
357 if x is None:
358 x = info['x0']
359 if y is None:
360 y = info['y0']
361
362 kwargs = cbook.normalize_kwargs(kwargs, Text)
363 kwargs.setdefault('horizontalalignment', info['ha'])
364 kwargs.setdefault('verticalalignment', info['va'])
365 kwargs.setdefault('rotation', info['rotation'])
366
367 if 'fontproperties' not in kwargs:

Callers 3

suptitleMethod · 0.95
supxlabelMethod · 0.95
supylabelMethod · 0.95

Calls 5

textMethod · 0.95
popMethod · 0.45
set_textMethod · 0.45
set_positionMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected