Adjust table formatting and title

This commit is contained in:
dotasek.dev 2024-04-23 11:46:41 -04:00
parent bebc2a6eb9
commit aa8979c3d4
1 changed files with 10 additions and 9 deletions

View File

@ -2,11 +2,8 @@ import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
#make this example reproducible
np.random.seed(0)
#define figure and axes
fig, ax = plt.subplots()
fig, ax = plt.subplots(1,1)
#hide the axes
fig.patch.set_visible(False)
@ -18,15 +15,19 @@ df = pd.read_csv('i18n-coverage.csv')
#create table
table = ax.table(cellText=df.values, colLabels=df.columns, loc='center')
#display table
fig.tight_layout()
#plt.show()
table.scale(1, 4)
table.auto_set_font_size(False)
table.set_fontsize(14)
ax.set_title('Loss by Disaster')
fig.tight_layout()
fig.set_figheight(2)
fig.set_figwidth(4)
ax.set_title('Internationalization Phrase Coverage by Locale')
fig = plt.gcf()
plt.savefig('i18n-coverage-table.png',
bbox_inches='tight',
dpi=150