I want to save the table of DataFrame as a picture and I get inspired from this question.
But sadly, the table picture I draw is so vague and I can't make it clear.
This is my environment:
Python 3.7.0
pandas 0.23.0
matplotlib 2.2.2
And here is my code, its table and my picture:
train_corr
Survived Pclass Age SibSp Parch Fare
Survive 1.000000 -0.338481 -0.077221 -0.035322 0.081629 0.257307
Pclass -0.338481 1.000000 -0.369226 0.083081 0.018443 -0.549500
Age -0.077221 -0.369226 1.000000 -0.308247 -0.189119 0.096067
SibSp -0.035322 0.083081 -0.308247 1.000000 0.414838 0.159651
Parch 0.081629 0.018443 -0.189119 0.414838 1.000000 0.216225
Fare 0.257307 -0.549500 0.096067 0.159651 0.216225 1.000000
from pandas.plotting import table
ax = plt.subplot(111, frame_on=False) # no visible frame
ax.xaxis.set_visible(False) # hide the x axis
ax.yaxis.set_visible(False) # hide the y axis
table(ax, train_corr, loc='center')
plt.savefig('correlation_matrix_HD.jpg')
And I have searched documentation about pandas.plotting and matplotlib.pyplot.table, but I still don't know how to figure it out.
If not mind, could anyone help me?
Thanks sincerely.