Find Patterns in Cluster

I have a heatmap and I would like to find some rectangles.

I have already used clustermap. But here, I can not calculate these rectangles. The order of the data should not be changed.

This Code is not working:

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(color_codes=True)
g = sns.clustermap(tips2, cbar="false")
plt.show()


Does somebody have an idea?

Thanks a lot

Here is an example of what I want:

• What is pd, pandas? And sns? What are the reasons to select those rectangles and not others (without the reasons it will be hard to find a solution)? Why do you say the code is not working, how does it fail (which error, what is the output compared to the expected output...) ?
– llrs
Oct 18 '17 at 7:15
• What is "the recheck"? How do you define the rectangles?A rectangle is a cluster of samples and genes?
– llrs
Oct 18 '17 at 8:57
• Can you give us a Minimal, Complete, and Verifiable example with some sample data, the rules to find the cluster ('recognizing optically' is not exact enough), and the expected results? Oct 18 '17 at 14:37
• Your example says "Cluster (for example)". Did you have criteria in mind to delimit the rectangles this way? Has the delimitation of rectangles an influence on the delimitation of others (for instance, by forbidding overlaps)? I think your question amounts to being able to formalize an intuition you have about how to form those rectangles.
– bli
Oct 19 '17 at 8:46
• Also, edit your question to add an explanation of what you mean by "This Code is not working". That's an important point.
– bli
Oct 19 '17 at 8:49