-
-
Notifications
You must be signed in to change notification settings - Fork 404
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
Fix data aspect issues #6189
Fix data aspect issues #6189
Conversation
@ahuang11 Please make sure you always paste the code for your reproducers. |
import panel as pn
import holoviews as hv
from holoviews.operation.datashader import rasterize
hv.extension("bokeh")
rasterize(hv.Curve([0, 1, 2])).opts(data_aspect=1) |
Am I meant to be able to reproduce an issue with that example? Because I can't. |
Were you using this branch or main? |
main |
To reproduce, I need to zoom a decent amount at once. |
Screen.Recording.2024-04-16.at.7.26.36.AM.mov |
Okay, you should have specified that this is specific to VSCode (or rather to |
This could be related to the change I made in #5780 |
Neither notebooks nor the server cases seem to be affected here. |
For versions, you could run |
Are you able to reproduce with this?
Okay I wasn't aware that VSCode notebook was different |
Nope, no issues. Suspect there's some deeper issue syncing bokeh properties in the ipywidgets comms case. |
The difference is that:
In future just make sure you note which environment(s) you tested in. |
I suspect there's a deeper issue with syncing bokeh properties in the ipywidgets based scenario. Will keep digging. |
Okay, thanks for trying it out. Anyhow, I think this PR might still be useful because I don't think the data aspect calculations (after the first) need to happen if the plot isn't
In the future, if I happen to forget, I default to VSCode |
This isn't true, axis labels can significantly impact the aspect. |
Really appreciate you chasing this btw. I just dug into the jupyter_bokeh IPyWidget wrapper and the issue seems to be to do with the serialization, it seems like the |
Edit: nevermind I see the internal plot's width being changed with the long tick axes.
I'm having a hard time wrapping my head around this. After initialization, the plot's frame_width + frame_height is set import numpy as np
import pandas as pd
import hvplot.pandas
df = pd.DataFrame(np.random.multivariate_normal((0,0), [[0.1, 0.1], [0.1, 1.0]], (500000,)))
df.hvplot.scatter("0", "1").opts(xlabel="abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef") |
Me too, me too!
Will have to very carefully review that bit of code to make sure that always holds true. Also my apologies, I meant the tick labels, not the axis labels. |
Turns out this was caused by a big oversight in The problem was that random events could end up being dropped and this reliably affected the end of the x_range, so the aspect calculation was thrown completely off by the fact that the |
I'm wondering if there's an issue in Jupyter notebook too because in Jason's Gerrymandering recording, we see data aspect issue at around 5s. holoviz-topics/examples#369 (comment) Gerrymanding.Final.Part.mp4 |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
The main issue here is that the
current_l, current_r = plot.x_range.start, plot.x_range.end
arrives late (or isn't up to date) so the data aspect calculation is messed up. There is, however,l, b, r, t = self.get_extents(element, ranges, dimension=range_dim)
which is up to date.Here, "current bounds" (inaccurate ylim) is 0.39 instead of 0.67 as seen on the plot axes. I could remove those lines, and the data aspect no longer bounces.
It was introduced in this PR #4569 and fixes holoviz/hvplot#462 so if I remove it, it reintroduces that error.
The only thing I'm pretty certain of is that if the plot isn't responsive, there's no need to re-calculate and ensure the data_aspect matches every time, which removes the bounciness:
Screen.Recording.2024-04-12.at.3.34.53.PM.mov
I think if there's a way to introduce value throttling, it could help.
Ultimately, I don't fully understand the difference between
l, b, r, t = self.get_extents(element, ranges, dimension=range_dim)
andplot.x_range
&plot.y_range