mmngreco
3/5/2018 - 3:15 PM

how_to_plot_table.md

To plot a table we can use plt.table()

data = some_data
cell_text = np.round(data.values, 3)
row_labels = data.index
col_labels = data.columns

# kw = dict(cellColours=[["#EEECE1"] * len(data.iloc[0])] * len(data))  # to fill cells with color
ytable = plt.table(cellText=cell_text, rowLabels=row_labels, colLabels=col_labels, loc="center right")
plt.axis("off")
plt.grid(False)
plt.show()

# ax.table(cellText=data_list,
#          rowLabels=rows,
#          colLabels=columns,
#          loc="upper center")

source : https://stackoverflow.com/questions/24343889/formatting-issues-with-table-image