Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b0d8b5f
Update table.py
saikarna913 Dec 8, 2024
46ab02e
Update table.pyi
saikarna913 Dec 8, 2024
1286c43
Update test_table.py
saikarna913 Dec 8, 2024
f54fd8c
Update pyplot.py
saikarna913 Dec 8, 2024
f31f5c7
Update table.pyi
saikarna913 Dec 8, 2024
889f514
Update test_table.py
saikarna913 Dec 8, 2024
74541b3
Update pylab.py
saikarna913 Dec 8, 2024
ff5d278
Update table.pyi
saikarna913 Dec 8, 2024
08e153c
Update pylab.py
saikarna913 Dec 8, 2024
8bebcf5
Update pyplot.py
saikarna913 Dec 8, 2024
1be1cb7
Merge branch 'matplotlib:main' into main
saikarna913 Dec 8, 2024
019811c
Update test_table.py
saikarna913 Dec 8, 2024
0d1689c
Update pyplot.py
saikarna913 Dec 8, 2024
d0a2d59
Update test_table.py
saikarna913 Dec 8, 2024
3773461
Merge branch 'matplotlib:main' into main
saikarna913 Dec 10, 2024
ddd10be
Update table.pyi
saikarna913 Dec 10, 2024
cbb7251
Update table.pyi
saikarna913 Dec 10, 2024
011ef04
Merge branch 'matplotlib:main' into main
saikarna913 Dec 12, 2024
cc6a42b
Update table.py
saikarna913 Dec 12, 2024
7113448
Update test_table.py
saikarna913 Dec 12, 2024
4e1661d
Update table.py
saikarna913 Dec 13, 2024
1194554
Update table.pyi
saikarna913 Dec 13, 2024
d3f1d47
Update lib/matplotlib/table.py
saikarna913 Dec 16, 2024
0857fc7
Update lib/matplotlib/table.py
saikarna913 Dec 16, 2024
c716def
Update table.pyi
saikarna913 Dec 16, 2024
90c69a7
Update pyplot.py
saikarna913 Dec 16, 2024
94da3f7
Update table.pyi
saikarna913 Dec 16, 2024
c2f9e8e
Update pyplot.py
saikarna913 Dec 16, 2024
d7b14f1
Update test_table.py
saikarna913 Dec 16, 2024
d54c3a3
Update test_table.py
saikarna913 Dec 16, 2024
6d1fb49
Update test_table.py
saikarna913 Dec 16, 2024
cbdd02c
Update table.py
saikarna913 Dec 16, 2024
c266b00
Update pyplot.py
saikarna913 Dec 16, 2024
5852fe2
Update table.pyi
saikarna913 Dec 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/matplotlib/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,5 +838,9 @@ def table(ax,
if rowLabelWidth == 0:
table.auto_set_column_width(-1)

# set_fontsize is only effective after cells are added
if "fontsize" in kwargs:
table.set_fontsize(kwargs["fontsize"])

ax.add_table(table)
return table
12 changes: 12 additions & 0 deletions lib/matplotlib/tests/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,3 +270,15 @@ def test_table_dataframe(pd):
for r, (index, row) in enumerate(df.iterrows()):
for c, col in enumerate(df.columns if r == 0 else row.values):
assert table[r if r == 0 else r+1, c].get_text().get_text() == str(col)


def test_table_fontsize():
# Test that the passed fontsize propagates to cells
tableData = [['a', 1], ['b', 2]]
fig, ax = plt.subplots()
test_fontsize = 20
t = ax.table(cellText=tableData, loc='top', fontsize=test_fontsize)
cell_fontsize = t[(0, 0)].get_fontsize()
assert cell_fontsize == test_fontsize, f"Actual:{test_fontsize},got:{cell_fontsize}"
cell_fontsize = t[(1, 1)].get_fontsize()
assert cell_fontsize == test_fontsize, f"Actual:{test_fontsize},got:{cell_fontsize}"