0

我知道使用 matplotlib 我可以用类似的东西放大正交投影:

import cartopy.crs as ccrs
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(1, 1, 1, projection=ccrs.Orthographic(-40, 20)
ax.set_extent([-110, 30, -20, 65])

我如何使用 hvplot / Geoviews / Holoviews 做到这一点?我发现的所有例子都没有放大这个特定的投影,

实际例子:

import xarray as xr
import hvplot.pandas
import holoviews as hv
import geoviews.feature as gf
import cartopy.crs as ccrs

proj = ccrs.Orthographic(-40, 20)
lon_range = (-110, 30)
lat_range = (-20, 65)

ds = xr.open_mfdataset(liste_files, engine="netcdf4")

pd_times = ds.to_dataframe() # <-- i cannot plot points with xarray directly, don't know why
points = pd_times.hvplot.points(x="longitude", y="latitude", c="sat1", projection=proj)

points = hv.Overlay(aff)

layout = (gf.ocean
    * points
    * gf.land.options(scale="50m")
    * gf.coastline.options(scale="50m")
    * gf.rivers
    * gf.lakes 
).opts(
    width=500, 
    projection=proj
)

谢谢

4

1 回答 1

0

成立:您需要在 hvplot 的参数中添加xlim和/或。ylim

points = pd_times.hvplot.points(x="longitude", y="latitude", c="sat1", projection=proj, xlim=lon_range, ylim=lat_range)
于 2020-09-01T09:47:55.630 回答