Cartopy's use of ax.add_image leaves me with a blank background, after initial attemps

Viewed 14

I ran the following from https://scitools.org.uk/cartopy/docs/v0.15/examples/eyja_volcano.html and it worked the first time (see first image)

I created another python module with the same code and it failed (see second image). I then started removing imports and making every as simple as possible. But I kept getting the second image blank image. Eventually, however even my first starting giving me blank (see how it looks in Pycharm in last image).

I have no errors, don't know how something can work once or few times and fail (maybe restart Python?)

Any debugging ideas would be greatly appreciated

# from https://scitools.org.uk/cartopy/docs/v0.13/examples/eyja_volcano.html
"""

https://scitools.org.uk/cartopy/docs/v0.15/examples/eyja_volcano.html
"""
import matplotlib.pyplot as plt
from matplotlib.transforms import offset_copy
import cartopy.crs as ccrs
import cartopy.io.img_tiles as cimgt

def main():

    # Create a Stamen Terrain instance.
    #stamen_terrain = cimgt.StamenTerrain() # got warning this way is depreciated
    stamen_terrain = cimgt.Stamen('terrain-background')

    # Create a GeoAxes in the tile's projection.
    ax = plt.axes(projection=stamen_terrain.crs)

    # Limit the extent of the map to a small longitude/latitude range.
    ax.set_extent([-22, -15, 63, 65])

    # Add the Stamen data at zoom level 8.
    ax.add_image(stamen_terrain, 7)

    # Add a marker for the Eyjafjallajökull volcano.
    plt.plot(-19.613333, 63.62, marker='o', color='red', markersize=12,
         alpha=0.7, transform=ccrs.Geodetic())

    # removed the rest
    plt.show()


if __name__ == '__main__':
    main()

images are first when it worked, after it stopped working, and screen shot of Pycharm

working

failed pycharm view

0 Answers
Related