Issues with projections and overlaying coastlines on a quadmesh?

Hi HoloViz Discourse.

I am attempting to create an overlay of a quadmesh hvplot and a geoviews feature coastline both with the cartopy Robinson projection. It’s not a global extent, I have a subset of data of just the North American region, and I’ve done the same to the coastline feature, so I have global_extent=False on both the quadmesh and the coastline.

This is what I am trying to accomplish, which works with the default PlateCaree very nicely. However, trying to change to any other projection results in two things: the coastlines becomes global and the Overlay zooms into a single point.

Here is code to reproduce of the working overlay with the PlateCaree projection:

import xarray as xr
import hvplot
import cartopy.crs as ccrs
import geoviews as gv 
import holoviews as hv

d = xr.tutorial.open_dataset('air_temperature').isel(time=0)

x = hv.Overlay(d.hvplot.quadmesh(x='lon', y = 'lat', projection=ccrs.PlateCarree(), global_extent=False) * gv.feature.coastline().opts(global_extent=False, projection=ccrs.PlateCarree(), xlim=(-180, -10), ylim=(10, 90)))

x

However, when I replicate this with the Robinson projection, or any other that I have tested (which includes Mollweide, Orthographic, North + South PolarStereo), I have two issues: zooming all the way in on the overlay, and a global extent appearing for the coastline.

Here is code that shows the issue:

import xarray as xr
import hvplot
import cartopy.crs as ccrs
import geoviews as gv 
import holoviews as hv

d = xr.tutorial.open_dataset('air_temperature').isel(time=0)

x = hv.Overlay(d.hvplot.quadmesh(x='lon', y = 'lat', projection=ccrs.Robinson(), global_extent=False) * gv.feature.coastline().opts(global_extent=False, projection=ccrs.Robinson(), xlim=(-180, -10), ylim=(10, 90)))

x

Does anyone know what might be going on here? Really appreciate any help or advice. Thank you!

Set crs=ccrs.PlateCaree()

Also maybe xlim/ylim doesn’t auto-project (or was it .redim.range() I forget which one)

That fixed it! Thank you, I appreciate it. This makes me think that a crs argument would also be handy in the Geoviews Quadmesh/Image for this reason as well.

crs does exist for gv.QuadMesh/gv.Image I think