2
Cartopy를 사용하여 North Polar Stereographic 맵 투영에 등고선을 작성하려고합니다. 위도 0과 경도 35X 사이에 간격을 두는 문제를 해결하기 위해 add_cyclic_point()
을 사용했으며 문서 축 (always_circular_stereographic
)의 예를 따라지도 축을 설정했습니다.Cartopy polar stereographic plot에서 윤곽선으로 이상한 동작이 발생했습니다.
plt.contour
으로 전화하면 다음 플롯이 표시됩니다. 등고선 플로터가 355에서 0 경도로의 전환에서 혼란스러워지고 지구 주위에 등고선을 보내는 것처럼 보입니다. 내가 제대로 Cartopy 윤곽 플롯을 어떻게
import numpy as np
import cartopy.crs as ccrs
from cartopy.util import add_cyclic_point
import matplotlib.pyplot as plt
def define_map():
from matplotlib.path import Path
fig = plt.figure(figsize=(10,10))
ax = plt.axes(projection=ccrs.NorthPolarStereo())
ax.coastlines()
# From example: http://scitools.org.uk/cartopy/docs/latest/examples/always_circular_stereo.html
theta = np.linspace(0, 2*np.pi, 100)
center, radius = [0.5, 0.5], 0.5
verts = np.vstack([np.sin(theta), np.cos(theta)]).T
circle = Path(verts * radius + center)
ax.set_boundary(circle, transform=ax.transAxes)
return(fig, ax)
lats = np.arange(65,91,5)
lons = add_cyclic_point(np.arange(0,359,5))
data = add_cyclic_point(np.random.random((len(lats),len(lons)-1)))
fig, ax = define_map()
plt.contour(lons,lats,data,5,transform=ccrs.PlateCarree(), cmap=plt.cm.Blues)
plt.colorbar(fraction=0.05, shrink=0.9)
plt.show()
: 여기
내 코드? 또한 왜 등고선은 이 아닌transform=ccrs.PlateCarree()
으로 표시됩니까?