-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Plotly fails when using "scattergl" and value greater than 2^24 [Only on M1] #6820
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
Comments
This reproduces in both Chrome and Safari on M1 devices, despite them using different WebGL backends. Could plotly be sending different WebGL commands based on the architecture? |
Or is it regl? |
Safari's implementation of WebGL passes the
to:
This change in the order of floating-point operations leads to a difference in the calculation causing an incorrect position:
The position and translation
Which is the incorrect position shown in the initial bug report. As a workaround, |
I have the same issue for both, Safari + Chrome and M1 Pro chip. One should note that this is also a problem when plotting a time series on the x axis, as the timestamps are internally represented as large numbers (I guess unix timestamps?). |
Yeah, @djg pointed out what the problem is, and why it only affects M1 devices. (well technically it could impact any device, but luckily/unluckily doesn't) |
@alexcjohnson @archmoj can you guys weigh in plz? |
@djg thanks for the tip! I'm not too worried about the performance implications, in most practical cases we're limited more by data transfer than by the shaders for these charts, but of course this remains to be tested. I'd like to understand the extent of this a bit better though before we move on to implementation, and I don't have access to an M1 device so would be grateful if others could chime in:
|
I can confirm that @djg's suggestion fixed the issue for me. I added |
hi @justinjhendrick |
@Coding-with-Adam, yes, I'll give it a shot! I have a couple questions about how to do this:
|
@justinjhendrick we also maintain |
In response to point 1 from my earlier comment, I went looking for other affected WebGL trace types in addition to scattergl. I couldn't find any others that are affected by this same bug. I checked the following trace types:
I found precision issues generally with x-values near 1e9. Some of them seem like the integers are being converted to float32s and we're losing precision that way (similar to the scatter3d example from this comment). But I couldn't find any issues that were M1 Mac specific. Somewhat surprisingly, splom was not fixed by this change, despite also depending on regl-scatter2d. But I can repro that on Windows, so I guess that's being caused by something else. Can anyone else find M1 mac specific precision issues that aren't fixed by gl-vis/regl-scatter2d#36? If not, I recommend closing this ticket and tracking down the non-platform-specific precision bugs in another issue. |
When plotting using Plotly.newplot() and type scattergl on M1 machine, the plotting fails if the value of x-axis is greater than 2^24.
Example:
The data gets plotted on the margin which cannot be zoomed/panned. (16777217 is 2^24 + 1)
Attached screen shot. The issue only happens on M1 machine. On Intel hardware everything works well.
The text was updated successfully, but these errors were encountered: