2 years ago
#46468
user3622450
how to (long,lat) convert to physical coordinates
Please see example below:
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
def test():
fig = plt.figure()
pj = ccrs.Orthographic(central_longitude=0, central_latitude=0)
ax = fig.add_subplot(111, projection=pj, position=[0,0,1,1])
ax.set_global()
trans = ccrs.PlateCarree()
c = np.array([[0, 90], [90, 0], [ 0, -90], [-90, 0]])
x = pj.transform_points(trans, c[...,0], c[...,1])
s = ax.transData.transform(x[...,:2])
ax.plot(s.T[0], s.T[1], marker="o", transform=None, clip_on=False)
I do not understand why it fails in longitude direction, or how this could be fixed.
python
cartopy
0 Answers
Your Answer