0

I have created a table from a dataframe using matplotlib's table feature. However, even when I change the fontsize, the font appears the same and I am unsure why. I even tried expanding or reducing the figsize in addition, but this did nothing. How do I change the cell text size? Thanks!

fig = plt.figure(figsize=(5,3))
ax = plt.subplot(111)
ax.axis('off')
ax.table(cellText=df.values, colLabels=df.columns, bbox=[0,0,1,1], fontsize = 12)
Jane Sully
  • 3,137
  • 10
  • 48
  • 87
  • view this [link](https://stackoverflow.com/questions/15514005/how-to-change-the-tables-fontsize-with-matplotlib-pyplot) it will answer your question – Tushar Sharma Dec 20 '18 at 07:17

1 Answers1

0

Use set_fontsize():

fig = plt.figure(figsize=(5,3))
ax = plt.subplot(111)
ax.axis('off')
tab = ax.table(cellText=df.values, colLabels=df.columns, bbox=[0,0,1,1])
tab.set_fontsize(14)

Refer doc for further instruction.

meW
  • 3,832
  • 7
  • 27