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

Method set_stretch

lib/matplotlib/font_manager.py:999–1022  ·  view source on GitHub ↗

Set the font stretch or width. Parameters ---------- stretch : int or {'ultra-condensed', 'extra-condensed', 'condensed', \ 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', \ 'ultra-expanded'}, default: :rc:`font.stretch` If int

(self, stretch)

Source from the content-addressed store, hash-verified

997 raise ValueError(f"{weight=} is invalid")
998
999 def set_stretch(self, stretch):
1000 """
1001 Set the font stretch or width.
1002
1003 Parameters
1004 ----------
1005 stretch : int or {'ultra-condensed', 'extra-condensed', 'condensed', \
1006'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', \
1007'ultra-expanded'}, default: :rc:`font.stretch`
1008 If int, must be in the range 0-1000.
1009 """
1010 stretch = mpl._val_or_rc(stretch, 'font.stretch')
1011 if stretch in stretch_dict:
1012 self._stretch = stretch
1013 return
1014 try:
1015 stretch = int(stretch)
1016 except ValueError:
1017 pass
1018 else:
1019 if 0 <= stretch <= 1000:
1020 self._stretch = stretch
1021 return
1022 raise ValueError(f"{stretch=} is invalid")
1023
1024 def set_size(self, size):
1025 """

Callers 2

__init__Method · 0.95
set_fontstretchMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected