Centered text in matplotlib tables
Another answer, which edits cell alignment individually, serves this case and is more general, where only arbitrary columns (but not all) need to be centered (or any specific cells in that case).
Let's say you have a table with 5 rows - 3 columns. If you only want to edit the first column:
the_table = plt.table(cellText=cell_text, rowLabels=rows, rowColours=colors, colLabels=columns, loc='bottom') cells = the_table.properties()["celld"] for i in range(0, 5): 0]._loc = 'center'
I was stuck on this until I looked at the
source to share