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

Method auto_set_font_size

lib/matplotlib/table.py:130–139  ·  view source on GitHub ↗

Shrink font size until the text fits into the cell width.

(self, renderer)

Source from the content-addressed store, hash-verified

128 return self._text.get_fontsize()
129
130 def auto_set_font_size(self, renderer):
131 """Shrink font size until the text fits into the cell width."""
132 fontsize = self.get_fontsize()
133 required = self.get_required_width(renderer)
134 while fontsize > 1 and required > self.get_width():
135 fontsize -= 1
136 self.set_fontsize(fontsize)
137 required = self.get_required_width(renderer)
138
139 return fontsize
140
141 @allow_rasterization
142 def draw(self, renderer):

Callers 2

_auto_set_font_sizeMethod · 0.45
test_auto_columnFunction · 0.45

Calls 4

get_fontsizeMethod · 0.95
get_required_widthMethod · 0.95
set_fontsizeMethod · 0.95
get_widthMethod · 0.45

Tested by 1

test_auto_columnFunction · 0.36