0

I have taken one of the solutions from this page How do I plot only a table in Matplotlib?

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

fig, ax = plt.subplots()

# hide axes
fig.patch.set_visible(False)
ax.axis('off')
ax.axis('tight')

df = pd.DataFrame(np.random.randn(10, 4), columns=list('ABCD'))

ax.table(cellText=df.values, colLabels=df.columns, loc='center')

fig.tight_layout()

plt.show()

adding this didn't make any difference to the font size

ax.table(cellText=df.values, colLabels=df.columns, loc='center',fontsize=14)

how else can I change the size?

petezurich
  • 9,280
  • 9
  • 43
  • 57
user13412850
  • 509
  • 1
  • 5
  • 16

1 Answers1

1

Just add this line before plt.show:

plt.rcParams.update({'font.size': 14})
skowalak
  • 177
  • 10