-
-
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
Defining hard bounds when panning and zooming in bokeh backend #1019
Comments
Sounds like something else that could go into the Dimension properties once that is implemented... |
We already have range and soft_range so I don't think anything new is needed. Just need to define the semantics. |
@jbednar Any opinion on this? I think it would be nice to offer hard bounds on the axes, should we say that if you explicitly set an |
My intuition is that we should be using the hard range of a Dimension automatically in this way, but I would have to get some experience with it in practice for different plot types to be sure about that and to know whether it should be configurable. I think I'd always want such bounds, but can't be sure until I experience it. |
I think so too, but not actually having used it I don't know either. I know that zooming out far beyond the actual data is rarely useful and usually bad behavior. |
Right; "far beyond" is not useful and is very confusing. The question in my mind is about how big "far" is; we might need a configurable buffer, such that we can zoom out to 150% of the range, e.g., but not further. And of course anything like that then gets tricky for log axes, in which it would need to be 150% of the pixel area corresponding to the range. So, need to try it out to see if any such buffer is needed; it's simpler if it turns out not to be. |
Did anyone succeed in writing a work around solution for this? I think hard bounds are a very important feature, especially for boundaries of Image/Raster plots. |
For anyone wondering, as of now, there's a workaround by accessing the underlying bokeh-figure:
|
Other suggestions: import holoviews as hv
import dask.array as da
import panel as pn
sx = sy = 1000
arr = da.random.random((sx, sy))
img = hv.Image((range(sx), range(sy), arr))
fig = hv.render(img)
fig.x_range.bounds = (0, sx)
fig.y_range.bounds = (0, sy)
pn.panel(fig) or using a hook: import holoviews as hv
from bokeh.io import show
import dask.array as da
renderer = hv.renderer('bokeh')
sx = sy = 1000
arr = da.random.random((sx, sy))
img = hv.Image((range(sx), range(sy), arr))
def set_bounds(fig, element):
fig.state.x_range.bounds = (0, sx)
fig.state.y_range.bounds = (0, sy)
img.opts(hooks=[set_bounds]) |
Trying out the hook for that example makes me more confident that HoloViews should enforce hard bounds by default. It's a much better user experience. My guess is that now that HoloViews adds padding automatically, the padded range is already precisely the range that is also the most useful default hard bounds for pan and zoom. There are no doubt some cases and some users who want to be able to zoom out beyond that, but my gut is that those are very rare and that the current behavior is much more surprising and annoying to a huge class of users than it will be for those rare users who find that they want it to behave the current way. So it's important to be configurable, but I am still strongly advocating for enabling hard bounds by default. It would be nice to have a dev build of the HoloViews website where such bounds are enabled by default for all plots and we can try them out with all the different plot types in the reference gallery to further validate it. |
you can now achieve this with HoloView's support of backend_opts, e.g.: backend_opts={ Update: use |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Currently when plotting using bokeh the axes are unbounded letting you zoom and pan to potentially empty parts of the data space. Since bokeh 0.11 it has been possible to bound the axis ranges to stop you from zooming or panning outside the desired region. We should decide how to expose this? Should axes ranges always be hard bounded or should setting an explicit dimension range bound them? There's a variety of behaviors we could consider here and just wanted to get discussion around this started.
The text was updated successfully, but these errors were encountered: