为什么散点图不能在曲目创建的地图上

发布于 2025-02-07 08:45:42 字数 350 浏览 1 评论 0 原文

plt.figure(figsize = (10,10),dpi =150)
ax = plt.axes(projection=ccrs.EuroPP())

ax.coastlines(resolution='50m')
ax.set_extent([-16., 5., 49., 61.])


plt.scatter([10.,15.],[52.5,55.],marker='o',s = 100,
            transform = ccrs.EuroPP(), color = "red")

ax.gridlines(draw_labels=True)
plt.show()

为什么只有地图,散点图不能在地图上?

plt.figure(figsize = (10,10),dpi =150)
ax = plt.axes(projection=ccrs.EuroPP())

ax.coastlines(resolution='50m')
ax.set_extent([-16., 5., 49., 61.])


plt.scatter([10.,15.],[52.5,55.],marker='o',s = 100,
            transform = ccrs.EuroPP(), color = "red")

ax.gridlines(draw_labels=True)
plt.show()

Why there is only a map, and the scatter plot cannot be on the map?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

萌面超妹 2025-02-14 08:45:43

您指定的分散的转换应该是数据的投影,而不是地图的投影。看起来好像它们是LAT/LON值(EPSG:4326)? (从技术上讲,他们当然可以是Europp坐标,真的很接近起源)

您希望这些点或多或少地在哪里?

map_proj = ccrs.EuroPP()
data_proj = ccrs.PlateCarree()

fig, ax = plt.subplots(
    figsize=(10,10), dpi=76, 
    subplot_kw=dict(projection=map_proj),
)

ax.scatter(
    [10.,15.],[52.5,55.], marker='o', s=100, 
    color="r", transform=data_proj,
)

ax.coastlines(resolution='50m')
ax.set_extent([-5., 20., 49., 61.], crs=data_proj)
ax.gridlines(draw_labels=True)

The transform you specify for the scatter should be the projection of the data, not the map. It looks as if they are lat/lon values (epsg:4326)? (Technically they could of course be EuroPP coordinates, just really close to the origin)

Where do you expect those points to be more or less?

map_proj = ccrs.EuroPP()
data_proj = ccrs.PlateCarree()

fig, ax = plt.subplots(
    figsize=(10,10), dpi=76, 
    subplot_kw=dict(projection=map_proj),
)

ax.scatter(
    [10.,15.],[52.5,55.], marker='o', s=100, 
    color="r", transform=data_proj,
)

ax.coastlines(resolution='50m')
ax.set_extent([-5., 20., 49., 61.], crs=data_proj)
ax.gridlines(draw_labels=True)

enter image description here

音盲 2025-02-14 08:45:43

根据源代码
绘制限制是在代码的行中设置的: -

@property
def x_limits(self):
    return (-1.4e6, 2e6)

@property
def y_limits(self):
    return (4e6, 7.9e6)

值以仪表单位为投影坐标。
不在这些限制之外的散点点不会绘制。

According to the source code https://scitools.org.uk/cartopy/docs/v0.15/_modules/cartopy/crs.html#EuroPP
The plotting limits are set in the lines of code:-

@property
def x_limits(self):
    return (-1.4e6, 2e6)

@property
def y_limits(self):
    return (4e6, 7.9e6)

The values are in projection coordinates with meters unit.
The scatter points that fall outside these limits will not be plotted.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文