-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
plotly express scatterplots not displaying correctly in jupyter #4154
Comments
Tried it on a windows computer and it works there same version of plotly and pandas and the same version of python 3.11.3 |
Also the same plot but with line works perfectly so it only seems to happen with scatters over 1000 points on Arm for me. |
I am experiencing the same issue. Works great on my windows laptop but I see similar vertical lines on my Mac. If you hover your mouse around in spaces between the vertical lines, the annotation of the points that were supposed to be there (but are invisible for some reason) pop up. |
@OlovJ out of curiosity does the same issue occur with |
I can confirm the issue with |
I'm hitting the same issue using both versions 5.9.0 and 5.19.0 on MacOS. |
Just dug into the code and I've found the cause (thanks @OlovJ for investigating the 1000 point threshold - it helped to find the culprit). The issue here seems to be the renderer - see this line in the source code. Switching the renderer to "svg" solves this issue for me. px.scatter(df, x="time", y="value", render_mode="svg") |
@j-at-ch THank you for investigating this issue. But I'm actually not able to reproduce this error from the initial code posted. Can you please share the exact code you used to reproduce the error? |
@Coding-with-Adam I've posted a MWE .ipynb sheet on Google Colab here. Can you confirm that you see the rendering issue there? The issue seems to be how the system handles
II haven't found any documentation of this behaviour - and on MacOS using PyCharm to run jupyter notebooks the default behaviour seems to be "webgl" and so scatters with more than a certain number of points always show this undesirable binning effect. |
Thanks @j-at-ch . |
Thanks for the follow-up @Coding-with-Adam! I've updated a few things in the Google Colab notebook so that there are plots with:
Would you be able to check the updated plots are report if there are any differences please? At least then we'll be able to tell whether the behaviour some of us are observing is due to renderer options (and how our individual systems handle the auto option). |
hi @j-at-ch |
Here's what it looks like to me @Coding-with-Adam: Maybe this is a hardware-related issue for 'webgl'? I'm using MacOS with an M1 Pro chip. |
Thanks for sharing the images @j-at-ch . @alexcjohnson |
We've seen hardware-dependent precision issues in WebGL a few times... and it makes sense that it would show up mostly on date axes, where the zero is all the way back at 1970 so the difference of a few minutes in recent years is in a fairly deep digit. There's probably some ugly way around it for now (I seem to recall a command-line switch to use higher precision?) but it'll keep popping up unless we do something deeper like rescaling all the data around a zero that's on or near the actual axis range before we send it to WebGL. That's a pretty big project, but it would ensure WebGL gets the same precision as SVG. |
Thanks for the diagnosis @alexcjohnson - helpful context! Manually setting |
I have an issue with larger scatterplots not displaying correctly. I am using jupyter on a Mac M1 and both using it from vs code and from jupyter-lab have the same issue (or I might be doing something wrong)
When displaying 1000 points it works as I expect but as soon as I get over 1000 points the x-values is not correct any more
Will have the output:
and the plots

1000 points
and 1001 points

other information of value is that the hoover data is triggered in the correct place so when i hover empty space i get the correct popup

if i do it using go figures it works as expected
The text was updated successfully, but these errors were encountered: