-
Notifications
You must be signed in to change notification settings - Fork 47
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
Very hard to pick individual pixels on seaborn heatmaps (pcolormesh) #99
Comments
Are you using matplotlib inside a notebook, by chance? The matplotlib notebook backend has quite a few performance drawbacks and can have odd rendering in some browsers. There's not really much that can be done about that from the |
If you're not in a notebook, do you know which matplotlib backend you're using? What's happening (notebook or not) is that things are being refreshed too frequently. Hover mode in matplotlib normally checks if it's drawn recently and only updates if it hasn't, but that can break in some backends. I can't directly reproduce the issue locally, but that certainly doesn't mean it's not there, just that it's not there with the matplotlib backends I can test. |
My script is exactly as written, run from command line in python 3.6. So I assume I'm using the default backend. The performance is the same in notebook with %matplotlib notebook. You can't repro the accuracy issue, either? I can't test in python 3.8 because I get an exception:
|
There is no "default backend", for what it's worth. If nothing is specified, matplotlib chooses based on the OS and what packages are available. From the stacktraces, it looks like you're using TkAgg. That's what I'm using locally, as well, but I can't reproduce the issue. The same code works perfectly with no lag, zoomed in or not. However, I don't have any way to access a Windows machine, so there could be some OS-specific things at play. I'll try to see if I can find a friend with access to Windows to try to reproduce. FWIW, the error you posted is due to changes in the most recent version of matplotlib. It has been fixed in master. |
Can't test on mac due to same bug. When will the fix be available though pip install? |
I did pip uninstall and used setup.py install from master. The behavior is still the same as reported on windows python 3.8 and mac python 3.7. It's almost impossible to get a click to register once zoomed in, and the z values don't always reflect what the arrow is pointing at. Sometimes it gets into a state where it doesn't respond to any left flicks. Right click will make the box go away, but no amount of left clicks will bring up the box again at any zoom level. |
@joferkington Have you been able to repro the responsiveness and the accuracy problems? |
I still haven't been able to reproduce the issues you're seeing, unfortunately. I've gotten access to a Windows laptop and tested things there. Everything seems extremely responsive for me. However, for various reasons (not my machine and didn't want to install anything invasive), I haven't tested on Windows or MacOS with the latest version of matplotlib, which could explain the difference. |
Windows is not necessary, as my repro is exactly the same on Mac. You're sure you're running my script as written from command line and zooming to about that zoom level? And you get accurate values? I'm on matplotlib 20.2.3. Can any other packages affect it? Here's some package versions:
|
It's perfectly responsive for me with exactly that code yes. Especially when zoomed in. However, note that As a result, if you click the center of a cell, it won't register. If you plot with |
To get a sense of what I'm talking about, try using
|
Ok, well that's the issue. Your sample works well. sns "works" if I select very close to a pixel edge. But you have to have secret knowledge to know which edge pertains to which pixel (even if the arrow points to the right side of an edge, it will give you the left pixel value), Seems dumb that matplotlib can't pick inside a mesh polygon. Anyways, problem solved. Thanks. |
@steel3d - For what it's worth, I've considered hacking around the limitations of It's not impossible, but it's better addressed with changes to matplotlib, rather than changes to mpldatacursor. The last time I dug into it, it was easy to do for simple rectangular cases, but harder to do for the generic cases that |
Sorry, I don't even have time to work on my own stuff, not to mention stuff like this :) Hopefully at least this will save others some time, now that it's a known issue. |
Here's my test code:
It seems to work ok at default zoom, but when zoomed in, the graph almost never responds to mouse clicks, it's really hard to pick a point you want. Also, the arrow is inaccurate. As you can see in the screenshot, the arrow is pointing to a white pixel, but the z value is showing 0.5. Also, if a pixel is picked in the default zoom it's showing the wrong z value. You can see this when zoomed out, but it's especially obvious once you zoom in, you'll see the z value is not correct.
This is on a 16 core AMD Threadripper machine with 64GB RAM.
The text was updated successfully, but these errors were encountered: