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?

1 Answer 1

1

Just add this line before plt.show:

plt.rcParams.update({'font.size': 14})
Sign up to request clarification or add additional context in comments.

3 Comments

nope that didnt work
Weird, it worked for me with your code. Have you tried the proposed solution in this answer: stackoverflow.com/a/39566040/10056232
not sure if thats helpful, I think I got the answer but the index of the dataframe is causing issues. am going to close this Qs and start another thread.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.