Skip to content
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

hvplot.image() zoom causes axes limits to bounce around #462

Closed
scottyhq opened this issue May 8, 2020 · 15 comments · Fixed by holoviz/holoviews#4480 or holoviz/holoviews#4569
Closed
Labels
type: bug Something isn't working
Milestone

Comments

@scottyhq
Copy link

scottyhq commented May 8, 2020

Thanks for contacting us! Please read and follow these instructions carefully, then delete this introductory text to keep your issue easy to read. Note that the issue tracker is NOT the place for usage questions and technical assistance; post those at Discourse instead. Issues without the required information below may be closed immediately.

ALL software version info

hvplot 0.5.2
bokeh 2.0.1

Description of expected behavior and the observed behavior

Plotting image results in axes and colorbar limits jumping around. A zoom box draw partially outside valid pixels of image causes further jumping around of axes limits.

Complete, minimal, self-contained example code that reproduces the issue

https://gist.github.com/scottyhq/0e245fcd62d8a46b82a4186fcd8945e6#file-hvplot-zoom-ipynb

# Lots of window and colorbar rescaling happening when first plot, and upon zooming
band1.hvplot.image(x='x',y='y',
                   crs='epsg:32645', 
                   tiles='OSM', 
                   rasterize=True,
                   width=700, height=500, 
                   cmap='plasma', 
                   logz=True,
                   alpha=0.7)

Stack traceback and/or browser JavaScript console output

No error or traceback, but the behavior is buggy. See gif:

Screenshots or screencasts of the bug in action

hvplotzoom

@rsignell-usgs
Copy link

rsignell-usgs commented May 8, 2020

We this issue also. For us it was not bouncing but constant unzooming! intake/xrviz#70 (comment)

@philippjfr philippjfr added the type: bug Something isn't working label May 8, 2020
@philippjfr
Copy link
Member

Can't seem to reproduce anymore with latest versions of everything. Will make dev versions of everything available for testing.

@scottyhq
Copy link
Author

scottyhq commented Jun 5, 2020

@philippjfr - This still seems to be an issue with the latest hvplot release (0.6). I updated the binder link in the first comment with new versions, so that you can reproduce the issue. The bug seems to be limited to when crs is set as an argument.

@philippjfr
Copy link
Member

I think this won't be fixed properly until I release HoloViews 1.13.3. Hopefully this weekend.

@scottyhq
Copy link
Author

Related issue: holoviz/geoviews#418

@philippjfr
Copy link
Member

I can still reproduce this but tackling this now before I release 1.13.3. Note that a workaround for now is to set a frame_width and frame_height. The problem is that the initial aspect calculations are off because the regular width/height include the axes and colorbars, which means that once it knows the size of the canvas it makes a number of adjustments and gets into weird loops because the width of tick labels changes which again causes the canvas area to change in size causing another change in the aspect and so on.

@rsignell-usgs
Copy link

@philippjfr, I'm still getting this issue with holoviews 1.13.3 in certain cases (although I can fix it by setting frame_width and frame_height as you suggest).

This video demonstrates the problem.

The code to reproduce the video is:

import xarray as xr
import hvplot.xarray

url = ('http://geoport.whoi.edu/thredds/dodsC/vortexfs1/usgs/users'
      '/scook/proj/DE_Bay/run07/subtidal/de_bay_run07_subtidal.ncml')

ds = xr.open_dataset(url)
ds.salt.sel(ocean_time='2017-08-05')[-1,:,:].hvplot.quadmesh(x='lon_rho',y='lat_rho', 
            geo=True, tiles='OSM', rasterize=True, cmap='rainbow')

And then change the value using the selection slider.

@rsignell-usgs
Copy link

rsignell-usgs commented Jul 22, 2020

Ugh. I'm getting it also even if I specify the frame_width and frame_height:

https://www.screencast.com/t/qyLnryCbbv

import xarray as xr
import hvplot.xarray

url = ('http://geoport.whoi.edu/thredds/dodsC/vortexfs1/usgs/users'
      '/scook/proj/DE_Bay/run07/subtidal/de_bay_run07_subtidal.ncml')

ds = xr.open_dataset(url)
ds.salt.hvplot.quadmesh(x='lon_rho',y='lat_rho', frame_width=600, frame_height=400,
            geo=True, tiles='OSM', rasterize=True, cmap='rainbow')

@philippjfr
Copy link
Member

Strange, I can definitely reproduce.

@philippjfr philippjfr reopened this Jul 22, 2020
@philippjfr philippjfr added this to the v0.6.1 milestone Jul 22, 2020
@philippjfr
Copy link
Member

@rsignell-usgs The dataset doesn't seem to be available anymore: http://geoport.whoi.edu/thredds/dodsC/vortexfs1/usgs/users/scook/proj/DE_Bay/run07/subtidal/de_bay_run07_subtidal.ncml

Is there anywhere I can access it?

@rsignell-usgs
Copy link

rsignell-usgs commented Aug 24, 2020

@philippjfr , the link you provided is the OPeNDAP Data URL -- you need to append .html to browse the dataset metadata so:
http://geoport.whoi.edu/thredds/dodsC/vortexfs1/usgs/users/scook/proj/DE_Bay/run07/subtidal/de_bay_run07_subtidal.ncml.html

To access the data in xarray we use the OPeNDAP Data URL, and when I just tried, the above python code is still working.

@philippjfr
Copy link
Member

Ah, thanks and sorry about the false alarm, I tried just downloading it so I could speed the process up.

@philippjfr
Copy link
Member

I think I've finally got a real fix here, my previous approach was very obviously wrong after looking at it again. Will try to get 1.13.4 out asap.

@JessicaS11
Copy link

Any update on when we can expect 1.13.4? I recently started using Holoviews and have been liking it so far, but have been having to force restart my kernel frequently due to this issue. I was excited to learn that it was already a known bug that has a fix coming in the next release!

@philippjfr
Copy link
Member

I'm currently trying to fix an issue building the documentation for HoloViews. Otherwise nothing is holding up the release now so I'm hoping today or tomorrow is the date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment