在 cartopy 中获取经度和纬度的鼠标位置 (python)

Getting mouseposition in longitude and latitude in cartopy (python)

我正在尝试通过标准 matplotlib 事件处理使用 cartopy 获取鼠标位置的经度和纬度。但是当我的 button_press_event 触发时,event.x 只是给出图中的像素位置(像往常一样)和 event.xdata 一些我无法真正定义的任意数字,但在 180°W 和东经 180°

那么我怎样才能得到鼠标光标在墨卡托投影中的 longitude/latitude 位置?

基本上这回答了问题:

Obtaining coordinates in projected map using Cartopy

Cartopy 在使用墨卡托投影时显然使用了其他坐标系。当转换回 PlateCarree 投影时,它将 "arbitrary numbers" 转换回 lat/lon 对。