8000 Heatmap mouseover by tacaswell · Pull Request #496 · mwaskom/seaborn · GitHub
[go: up one dir, main page]

Skip to content

Heatmap mouseover #496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed

Conversation

tacaswell
Copy link
Contributor

Closes #495 for real.

Add factory function to generate functions to return a label
based on a list given a float coordinate.
Display (x=xlabel, y=ylabel, z=val)
Display (x=xlabel, y=ylabel, z=val) as cursor is moved around plot
@mwaskom
Copy link
Owner
mwaskom commented Apr 1, 2015

This isn't something that can be handled on your end? Seaborn is likely not the only place people are going to want to use categorical labels on the axes of a pcolormesh plot...

@michaelaye
Copy link
michaelaye < 8000 /strong> commented Apr 1, 2015

This works for me but could the implementation of showing the z value here not clash with matplotlib/matplotlib#3989 ?

@tacaswell
Copy link
Contributor Author

mpl does not capture enough semantic information to be able to reliably tell when the user is plotting categorical data or not. That knowledge is captured at the seaborn level (by which functions are being used) so this formatting should live downstream. Eventually the z-data should move upstream, but reporting the x and y position as labels should not.

@michaelaye If you are using a version of mpl with matplotlib/matplotlib#3989 you will get this plus the artist specific string on the end. The brains to modulate if the z string is included should probably be in seaborn based on what version of mpl it is built on top of.

I thought about just doing the x and y values, but figured that you would also want the z value now rather than some time this summer 😉 .

@mwaskom
Copy link
Owner
mwaskom commented Apr 1, 2015

mpl does not capture enough semantic information to be able to reliably tell when the user is plotting categorical data or not. That knowledge is captured at the seaborn level (by which functions are being used) so this formatting should live downstream. Eventually the z-data should move upstream, but reporting the x and y position as labels should not.

Perhaps not automatically, but as an option in pcolormesh (xcellnames, ycellnames, e.g.) or a more general categorical axes object that the mouse stuff knows how to do lookups on. Each seem like they would be useful. I am unenthusiastic about adding a lot of random shim code all over seaborn to handle matplotlib interaction stuff that I don't use and am not at all knowledgeable about.

@mwaskom
Copy link
Owner
mwaskom commented Apr 1, 2015

Or alternatively there is already the pcolormesh(X, Y, C) signature, which could be generalized to treat the coordinate vectors as categorical when they cannot be converted to numerics.

@tacaswell
Copy link
Contributor Author

Similarly, I am unenthusiastic about mpl absorbing lots of shims to deal with domain-specific assumptions. I view seaborn as the domain specific code base where those details live.

I am some what surprised you don't use any of the interaction. That is leaving a tremendous amount of the mpl's power on the table.

@mwaskom
Copy link
Owner
mwaskom commented Apr 1, 2015

Then I suppose we are at an impasse.

@mwaskom mwaskom closed this Apr 1, 2015
@mdboom
Copy link
mdboom commented Apr 1, 2015

I'll apologize for my hasty solution in matplotlib/matplotlib#4302 that perhaps "gave hope" to this being a simple bug. I think @tacaswell's descriptions make it clear why this isn't so easy and that, at least currently, seaborn has the semantic knowledge to do this in the right way but matplotlib doesn't.

To give some context, matplotlib I think historically has been burned by "assuming too much" in some of its interfaces, and while we can make changes on the matplotlib end to handle this other third-party tools may not agree.

I would be nice to step back and find a way forward here... Perhaps as a way of comparing apples to apples, we already have a sense of what this looks like to solve it on the seaborn end in this PR. What would this look like to solve on the matplotlib end -- and how, specifically, would it limit matplotlib's API flexibility in the future? I think an implementation might clarify those points.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

corrplot does not show cell coordinates with nbagg backend
4 participants
0