I am trying to publish a figure of a table that has been created from a dataframe for use in a report.
#Hard Coding example
TopTenSites = 238
RestOfSites = 387
#Creating a dataframe to pass into
Proportion = pd.DataFrame({'Incidence': [TopTenSites, RestOfSites]},
index=['Top 10 Sites', 'Rest of Sites'])
#Creating the table
fig, plot = plt.subplots(figsize = [3,2])
#plot.axis('off')
#Remove axis
plot.xaxis.set_visible(False)
plot.yaxis.set_visible(False)
#Creating the table
plot.table(cellText = Proportion.values, rowLabels = Proportion.index, loc = 'center', colLabels =
Proportion.columns,cellLoc = 'center')
plt.savefig('Proportion.png')enter code here
The output in Jupyter notebook gives a table which looks like.
But the actual png produced by this code looks like
Does anyone know the formatting for a table so I can produce a png file that looks exactly like the
output where the row labels are included.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…