I am trying to use Cartopy's proejction NearsidePerspective, but overlaping with the real Earth image provided by Matplotlib, and zooming in a bit by lowering the satellite_height
parameter. It appears that Cartopy is not able to trim the image properly for this specific type of setting. The image is displayed still oustide of what one would expect to be the map boundaries.
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
fig=plt.figure(figsize=(10,10))
# Set Projection
height=3000000
#height=35785831 # this is the default height
projection=ccrs.NearsidePerspective(central_longitude=120,
central_latitude=78,
satellite_height=height)
# Draw
ax = plt.axes(projection=projection)
ax.stock_img()
ax.coastlines(resolution='50m')
plt.show()
How can I combine Matplotlib's stock_img() and this configuration of NearsidePerspective to work properly? Or what would be an alternative way to get the result desired?
I am using Python 3.6 on Jupyter Notebook, Matplotlib 3.0.2, and Cartopy 0.16.0.
Using the same code on a mac with Python 3.7, Matplotlib 3.0.3, and Cartopy 0.17.0, the image is cropped correctly:
This may either be a version problem or with Jupyter Notebook.