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

Function test_auto_column

lib/matplotlib/tests/test_table.py:127–178  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

125
126@image_comparison(['table_auto_column.png'], style='mpl20')
127def test_auto_column():
128 fig, (ax1, ax2, ax3, ax4) = plt.subplots(4, 1)
129
130 # iterable list input
131 ax1.axis('off')
132 tb1 = ax1.table(
133 cellText=[['Fit Text', 2],
134 ['very long long text, Longer text than default', 1]],
135 rowLabels=["A", "B"],
136 colLabels=["Col1", "Col2"],
137 loc="center")
138 tb1.auto_set_font_size(False)
139 tb1.set_fontsize(12)
140 tb1.auto_set_column_width([-1, 0, 1])
141
142 # iterable tuple input
143 ax2.axis('off')
144 tb2 = ax2.table(
145 cellText=[['Fit Text', 2],
146 ['very long long text, Longer text than default', 1]],
147 rowLabels=["A", "B"],
148 colLabels=["Col1", "Col2"],
149 loc="center")
150 tb2.auto_set_font_size(False)
151 tb2.set_fontsize(12)
152 tb2.auto_set_column_width((-1, 0, 1))
153
154 # 3 single inputs
155 ax3.axis('off')
156 tb3 = ax3.table(
157 cellText=[['Fit Text', 2],
158 ['very long long text, Longer text than default', 1]],
159 rowLabels=["A", "B"],
160 colLabels=["Col1", "Col2"],
161 loc="center")
162 tb3.auto_set_font_size(False)
163 tb3.set_fontsize(12)
164 tb3.auto_set_column_width(-1)
165 tb3.auto_set_column_width(0)
166 tb3.auto_set_column_width(1)
167
168 # 4 this used to test non-integer iterable input, which did nothing, but only
169 # remains to avoid re-generating the test image.
170 ax4.axis('off')
171 tb4 = ax4.table(
172 cellText=[['Fit Text', 2],
173 ['very long long text, Longer text than default', 1]],
174 rowLabels=["A", "B"],
175 colLabels=["Col1", "Col2"],
176 loc="center")
177 tb4.auto_set_font_size(False)
178 tb4.set_fontsize(12)
179
180
181def test_table_cells():

Callers

nothing calls this directly

Calls 5

auto_set_column_widthMethod · 0.80
subplotsMethod · 0.45
axisMethod · 0.45
auto_set_font_sizeMethod · 0.45
set_fontsizeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…