-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
Improve x-limit, y-limit, and rasterize support for geo features #1135
Conversation
29174a7
to
c3785cf
Compare
At some point, I want it only to be needed to pass limits directly into hvplot like |
@ahuang11, can you try to play around with the latest commit? import hvplot.xarray
import xarray as xr
import cartopy.crs as ccrs
ds = xr.tutorial.open_dataset("air_temperature")
ds.hvplot.points(
"lon",
"lat",
crs=ccrs.PlateCarree(),
features=["coastline", "land"],
xlim=(-140, -80),
ylim=(20, 45),
projection=ccrs.LambertConformal(),
rasterize=True,
dynspread=True,
) |
Thanks! Most of the things I tried worked. This still doesn't work: import hvplot.xarray
import xarray as xr
import cartopy.crs as ccrs
ds = xr.tutorial.open_dataset("air_temperature")
ds.hvplot.points(
"lon", "lat", crs=ccrs.PlateCarree(), projection=ccrs.GOOGLE_MERCATOR, tiles=True
).opts(xlim=(-140, -80), ylim=(20, 45)) Dropping tiles works. |
But putting |
Yes |
I think this is more of a problem with GeoViews with projected overlays as this will also zoom in to small numbers: import cartopy.crs as ccrs
import geoviews as gv
ds = xr.tutorial.open_dataset("air_temperature")
plot = gv.Points(ds.isel(time=0), kdims=["lon", "lat"]).opts(projection=ccrs.GOOGLE_MERCATOR)
(plot * plot).opts(xlim=(-140, -80), ylim=(20, 45)) |
Right, I'm not sure how it gets handled without overlays, but xlim/ylim is not being projected properly in opts when there's an overlay. |
My example above works fine if there is no overlaid: I don't think we can do anything on the hvplot side of things. |
It might be related to this: |
One last comment is can we rename |
I don't mind a better name, but I'm not sure if it's correct to call it |
maybe |
The latest release of hvplot has problems with xlimit and ylimit, which is what this PR is trying to fix. |
All in all, I think this PR generally improves geo support! Do you think a test should be added for rasterize + points? |
Yes! But I didn't want to do it before we agreed this was the right approach. |
Right; I suppose I should have commented under |
I don't know. But if I move around the image on the latest release it disappears, which does not happen after this PR. |
Okay; I think after tests are added, this can be merged. |
Fixes #1093
Fixes #1090
Fixes https://discourse.holoviz.org/t/any-smart-approach-for-determining-what-holoviz-package-broke-my-notebook/5944
If geo is true, we will use GeoViews tile sources, and if false, we will use HoloViews. GeoViews features and tiles are projected to the respective projection.
1093 code:
1090 code:
Code from #1053 (Comments are from original PR; it seems that every case works)
Case 1:
It works but gives a long empty plot, with one red dot.