I'm supposed to draw a map using cartopy. The assignment is:
Use the orthographic projection, centered on Hamburg, and draw the great circle path between Hamburg and Tokyo
import cartopy import cartopy.crs as ccrs ax = plt.axes(projection=ccrs.Orthographic(central_longitude = long_ham, central_latitude = lat_ham)) ax.coastlines() long_ham, lat_ham = 9.993682, 53.551086 long_tok, lat_tok = 139.839478, 35.652832 plt.plot([long_ham, long_tok], [lat_ham, lat_tok], color='blue', linewidth=2, marker='o', transform=ccrs.Geodetic(), ) plt.text(long_ham , lat_ham , 'Hamburg', horizontalalignment='right', transform=ccrs.Geodetic()) plt.text(long_tok , lat_tok , 'Tokyo', horizontalalignment='left', transform=ccrs.Geodetic()) # Save the plot by calling plt.savefig() BEFORE plt.show() plt.savefig('great circle distance.pdf') plt.savefig('great circle distance.png') plt.show() 
Is there a way to show the whole globe instead of the close up that I'm currently getting?
https://stackoverflow.com/questions/67215829/drawing-great-circle-path-with-cartopy April 22, 2021 at 11:00PM
没有评论:
发表评论