Large numbers make matplotlib table unreadable

Viewed 27

I'm doing some thermodynamics homework in a jupyter notebook, and one of the problems involves some very large numbers that I'm trying to display in a matplotlib table. I cannot figure out how to make the numbers display in scientific notation, so they display in very small font that is unreadable. Here is what I have right now:

fig, ax = plt.subplots()

fig.patch.set_visible(False)
ax.axis('off')
ax.axis('tight')
b = [0,1,2,3,4,66,67,68,100]

data = np.asarray([[qa[i] for i in b],[Oa[i] for i in b],[qb[i] for i in b],
        [Ob[i] for i in b],[Ototal[i] for i in b]])
dataT = data.T
table = ax.table(cellText=dataT, colLabels = ['$q_A$','$\Omega_A$',
        '$q_B$','$\Omega_B$','$\Omega_{total}=\Omega_A\Omega_B$'],
        loc = 'center')

fig.tight_layout()
plt.show()
microstates = np.sum(Ototal)
print('The total number of microstates is', '{:.2e}'.format(microstates), '.')

The resulting table looks like this:

enter image description here

How can I reduce the number of digits displayed so that the table is readable?

0 Answers
Related