【问题标题】:How to zoom Orthographic projection with geoviews?如何使用地理视图缩放正交投影?
【发布时间】:2020-12-19 08:15:56
【问题描述】:

我知道使用 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
)

谢谢

【问题讨论】:

    标签: matplotlib cartopy orthographic hvplot geoviews


    【解决方案1】:

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

    points = pd_times.hvplot.points(x="longitude", y="latitude", c="sat1", projection=proj, xlim=lon_range, ylim=lat_range)
    

    【讨论】:

      猜你喜欢
      • 2021-06-08
      • 2014-07-06
      • 2013-11-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-11
      相关资源
      最近更新 更多