import matplotlib.pyplot as plt
import seaborn as sns
# optional: resize images from now on
plt.rcParams["figure.figsize"] = (16, 12)
# numeric_only_columns is a list of columns of the DataFrame
# containing numerical data only
# annot = True to visualize the correlation factor
sns.heatmap(df[numeric_only_columns].corr(), annot = False)
plt.show()
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
# create some random data; replace that by your actual dataset
data = pd.DataFrame(np.random.rand(11, 5), columns=['A', 'B', 'C', 'D', 'E'], index = range(2000, 2011, 1))
# plot heatmap
ax = sns.heatmap(data.T)
# turn the axis label
for item in ax.get_yticklabels():
item.set_rotation(0)
for item in ax.get_xticklabels():
item.set_rotation(90)
# save figure
plt.savefig('seabornPandas.png', dpi=100)
plt.show()