Closed hdsingh closed 5 years ago
I've been hit by this as well. As a workaround I wanted to create a custom hover showing the z values only.
I have a vg.dataset
looking as following:
dataset = gv.Dataset(ds, ['longitude', 'latitude'], 'trends', crs=crs.PlateCarree())
print(dataset)
:Dataset [longitude,latitude] (trends)
But when I create a custom hover, the values are not shown and I see a ???
instead:
from bokeh.models import HoverTool
hover = HoverTool(
tooltips=[
("Trend", "@trends"),
]
)
image = dataset.to(gv.Image).redim.range(trends=(-1.5, 1.5))
plot = image.opts(cmap='RdBu_r', colorbar=True, width=1000, height=500,
projection=crs.Mollweide(), tools=[hover], active_tools=['pan','wheel_zoom']) * gf.coastline
plot
It's probably me doing something wrong here, but what?
Nevermind my question above, this seems to not yet be supported in Holoviews.
Using @image
works (took me some time to find out)
@jbednar , I'm hoping this is on the list of tasks to be done for Pangeo. We would really like to stop pinning holoviews to 1.12.1.
As a workaround, adding the projection
arg seemed to fix this for me. The projection
arg is meant to specify the target projection of the plot.
import xarray as xr
import hvplot.xarray
import holoviews as hv
import cartopy.crs as ccrs
print("hv.__version__: ",hv.__version__)
url = 'http://opendap.co-ops.nos.noaa.gov/thredds/dodsC/NOAA/LOOFS/MODELS/201907/glofs.loofs.fields.forecast.20190720.t06z.nc'
data = xr.open_dataset(url)
data = data.set_coords(['lat','lon'])
mesh = data.air_u[-1:,:,:].hvplot.quadmesh(x='lon', y='lat', rasterize=True,
crs=ccrs.PlateCarree(), projection=ccrs.PlateCarree())
mesh
So using latest holoviews and geoviews I actually can't reproduce this.
@jsignell Could you confirm?
Huh, very strange, suddenly I can reproduce it again.
Maybe you left off rasterize=True
?
So the very strange thing here is that it all seems to be set up correctly and it works when you do:
pn.panel(hv.render(mesh))
But somehow when letting HoloViews render it, the CustomJSHover
does not get called.
I'm getting the same hover issue (lat/lon show up as projected coords, not in degrees) with hvplot=0.7.2
, geoviews=1.9.1
, bokeh=2.3.0
. I see from digging through issues like this that the bug was meant to be fixed a couple years ago. Any advice?
Correct hover values in
hv.__version__: 1.12.1
:Incorrect hover values in
hv.__version__: 1.12.4
:Reproducible example:
Also correct behaviour is shown without using
crs
.