import matplotlib.pyplot as plt fig = plt.figure(dpi=80) ax = fig.add_subplot(1,1,1) table_data=[ ["matched gt", 10], ["unmatched gt", 20], ["total gt", 30], ["mean_precision", 0.6], ["mean_recall", 0.4] ] table = ax.table(cellText=table_data, loc='center') table.set_fontsize(14) table.scale(1,4) ax.axis('off') plt.show()
output:

table.scale
function will help adjust the row height to match to the font size.
Without the table.scale
function, here is what the output looks like.

3 Comments
kk · August 31, 2020 at 1:58 pm
Thank you!
jf · November 30, 2020 at 7:59 pm
Thanks a lot! Straightforward and helpful!
Toby · December 4, 2020 at 11:39 pm
This helped me with my uni project, thank you.