mwaskom / seaborn

Statistical data visualization in Python
https://seaborn.pydata.org
BSD 3-Clause "New" or "Revised" License
12.6k stars 1.93k forks source link

No mouseover "x=,y=" for `sns.heatmap` (works only on its colorbar), as if its `ax.format_coords()` was not set #3771

Closed MestreLion closed 1 month ago

MestreLion commented 1 month ago

This is much better explained in this SO question: Interactive sns.heatmap displays x, y only hovering over the colorbar

The comments suggest this is easy to implement, but I was unable to do so.

It does work fine if you replace the seaborn heatmap() call with direct calls to Matplotlib's pcolormesh() + colorbar(), i.e, instead of:

sns.heatmap(data, ...)

Use this

heat = plt.pcolormesh(data)
plt.colorbar(heat)

So something in Seaborn's usage or customization of Matplotlib's pcolormesh is "unsetting" its default format_coords, which I believe is a bug

mwaskom commented 1 month ago

I don't think this is expected to work, sorry!

MestreLion commented 1 month ago

Preliminary findings:

Some workarounds that Seaborn could adopt: