MCPcopy
hub / github.com/matplotlib/matplotlib / set_title

Method set_title

lib/matplotlib/legend.py:1050–1077  ·  view source on GitHub ↗

Set legend title and title style. Parameters ---------- title : str The legend title. prop : `.font_manager.FontProperties` or `str` or `pathlib.Path` The font properties of the legend title. If a `str`, it is interpreted

(self, title, prop=None)

Source from the content-addressed store, hash-verified

1048 return self._legend_box.align
1049
1050 def set_title(self, title, prop=None):
1051 """
1052 Set legend title and title style.
1053
1054 Parameters
1055 ----------
1056 title : str
1057 The legend title.
1058
1059 prop : `.font_manager.FontProperties` or `str` or `pathlib.Path`
1060 The font properties of the legend title.
1061 If a `str`, it is interpreted as a fontconfig pattern parsed by
1062 `.FontProperties`. If a `pathlib.Path`, it is interpreted as the
1063 absolute path to a font file.
1064
1065 """
1066 self._legend_title_box._text.set_text(title)
1067 if title:
1068 self._legend_title_box._text.set_visible(True)
1069 self._legend_title_box.set_visible(True)
1070 else:
1071 self._legend_title_box._text.set_visible(False)
1072 self._legend_title_box.set_visible(False)
1073
1074 if prop is not None:
1075 self._legend_title_box._text.set_fontproperties(prop)
1076
1077 self.stale = True
1078
1079 def get_title(self):
1080 """Return the `.Text` instance for the legend title."""

Callers 15

__init__Method · 0.95
titleFunction · 0.45
demoMethod · 0.45
demoMethod · 0.45
axes_margins.pyFile · 0.45
quick_start.pyFile · 0.45
colormapnorms.pyFile · 0.45
colors.pyFile · 0.45
demoFunction · 0.45
plot_color_gradientsFunction · 0.45
mosaic.pyFile · 0.45
axes_ticks.pyFile · 0.45

Calls 3

set_fontpropertiesMethod · 0.80
set_textMethod · 0.45
set_visibleMethod · 0.45

Tested by 1

test_rotation_modeFunction · 0.36