Combine two Heat Maps in Matplotlib
Combine two Heat Maps
import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns df1 = pd.DataFrame(np.random.rand(20, 4), columns=list("ABCD")) df2 = pd.DataFrame(np.random.rand(20, 4), columns=list("WXYZ")) fig, (ax1, ax2) = plt.subplots(ncols=2) fig.subplots_adjust(wspace=0.01) sns.heatmap(df1, cmap="rocket", ax=ax1, cbar=False) fig.colorbar(ax1.collections[0], ax=ax1, location="left", use_gridspec=False, pad=0.2) sns.heatmap(df2, cmap="icefire", ax=ax2, cbar=False) fig.colorbar(ax2.collections[0], ax=ax2, location="right", use_gridspec=False, pad=0.2) ax2.yaxis.tick_right() ax2.tick_params(rotation=0) plt.show()
The following is the output that will be obtained:
2018-11-19T03:43:31+05:30
2018-11-19T03:43:31+05:30
Amit Arora
Amit Arora
Python Programming Tutorial
Python
Practical Solution