'Getting data out of a data frame heatplot (not x nor y columns)

I want to get a profile of intensity out of a dataframe heat map but the data is not only in a row or column, for example:

import numpy as np 
from pandas import DataFrame
import matplotlib.pyplot as plt

index = ['1', '2', '3', '4', '5']
columns = ['A', 'B', 'C', 'D']
df = DataFrame(abs(np.random.randn(5, 4)), index=index, columns=columns)

plt.pcolor(df)
plt.yticks(np.arange(0.5, len(df.index), 1), df.index)
plt.xticks(np.arange(0.5, len(df.columns), 1), df.columns)
plt.show()

enter image description here

Is there a way to plot a profile from A2 to D4 (for example), maybe even doing some interpolation to get bit more smooth data.

Any ideas?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source