I found this plot/diagram and I would like to recreate it in Python. It feels like a heatmap with fixed labels or something, but I think there should be a better solution than that. Any help or hints would be appreciated.
In ideal case the solution will be in matplotlib/seaborn.
Here is python code to recreate the image:
import matplotlib.pyplot as plt
import squarify #pip install squarify
labels = [
"can't loose them", "loyal customers", "champions", "at risk", "need attention",
"potential loyalists", "new customers", "promising", "about to sleep", "hibernating"
]
sizes = [20, 25, 15, 20, 10, 25, 5, 10, 10, 15] # Adjusted sizes to match the number of labels
# Define colors to match the provided image
colors = ["#ff6666", "#66b3ff", "#33cc99", "#ffa500", "#ffff66",
"#9370DB", "#90EE90", "#20B2AA", "#8B4513", "#A9A9A9"]
plt.figure(figsize=(10, 6))
squarify.plot(sizes=sizes, label=labels, color=colors, alpha=0.7, text_kwargs={'fontsize': 10})
plt.xlabel("R", fontsize=12, fontweight='bold')
plt.ylabel("F", fontsize=12, fontweight='bold')
plt.axis("off")
plt.show()
Output: