Quadmesh, hover information and tiles

Hi everybody,

I don’t know if this is a bug, or if the hvplot is behaving as designed. My intention is to have a geographical map with latitudes and longitudes in the hover information and tiles with an irregular grid.

If the grid I use is regular, there is no problem, it uses Image and works fine (tiles and coordinates information in hover):

ds["air"].isel(time=0).hvplot.image(geo=True, tiles=True)

However, if it’s irregular, I need to use QuadMesh, the map appears correctly, but that’s where my problems start. In the hover information, ordinal numbers appear instead of latitudes and longitudes.

ds["air"].isel(time=0).hvplot.quadmesh(geo=True, tiles=True)

If I use the projection option to transform them into latitudes and longitudes, hover appears correctly, but the tiles option is ignored and they are not shown.

ds["air"].isel(time=0).hvplot.quadmesh(geo=True, tiles=True, projection=ccrs.PlateCarree())

Is there a way to use QuadMesh with latitudes and longitudes in the hover information and use the tiles option at the same time as you can with Image? I hope I’ve made myself clear.

Sample data is taken from air_temperature.nc dataset (xarray-data github repository). And my packages versiones (from conda-forge):

hvplot 0.5.2
geoviews 1.8.1
holoviews 1.13.1

I found the solution, I had to add rasterize=True option:

ds["air"].isel(time=0).hvplot.quadmesh(geo=True, tiles=True, rasterize=True)

Does anyone know why this is necessary?

It seems like a bug, rasterize regrids the irregular mesh to a regular mesh, i.e. to an image in HoloViews terms so that gets around the seeming bug in QuadMesh hover.

Thank you very much @philippjfr for your answer. Should I fill in an issue on holoviews or are they already aware of it?

I found some problems with rasterize=True. For example, many QuadMesh options are ignored (alpha, line_width, line_color…).

I don’t think we have an issue about it yet, so if you could file one that would be appreciated.

For example, many QuadMesh options are ignored (alpha, line_width, line_color…).

Right, line_width, line_color etc. are not valid options anymore. That said I would expect alpha to work, so if that’s reproducible that’s another issue to file for hvPlot.

True, but not this way:

ds["air"].isel(time=0).hvplot.quadmesh(geo=True, tiles=True, rasterize=True, alpha=0.5)

I get alpha working only this way:

ds["air"].hvplot.quadmesh(geo=True, tiles=True, rasterize=True).opts("Image", alpha=0.5)

Do I fill the issue in hvplot or holoviews?

Thanks!

hvPlot in this case.

Done:

Thank you very much for your time @philippjfr!