rotationprojectionfigurecartopydisplayobject

Can I rotate a Cartopy Projection to make the figure show the country of interest in the vertical orientation?


I'm doing a Stereographic Cartopy projection of some Greenland ice sheet data. When I plot the projection without any attributes, I get a slightly rotated Greenland. When I set the central_latitude and central_longitude to center over Greenland, it turns Greenland so that it's horizontal. I need to display the figure vertically. I'm able to rotate the entire resulting image but then the colorbar and title are still along the long sides of the figure.

ax = fig.add_axes([0.1,0.1,0.8,0.8], projection=ccrs.Stereographic(central_latitude=42.6043, central_longitude=71.7069)) gives a horizontal Greenland

ax = fig.add_axes([0.1,0.1,0.8,0.8], projection=ccrs.Stereographic() gives a slightly rotated Greenland

Using

angle = 90

out = im.rotate(angle, expand=True)

just rotates the entire image, not the figure, seen here

Is it possible to rotate the projection/figure so that Greenland is centered vertically?


Solution

  • What you're trying to do is correct, but your coordinates seem off. Greenland is not located at a latitude of 42 nor at a longitude of 71. The point you specify is somewhere in the North West of Kyrgyzstan:
    https://www.google.com/maps/@42.604,71.707,12z

    Perhaps you flipped longitude and latitude, and assumed that the longitude of 42 means west? The common way to express longitude to be positive for east and negative for west, which is also what Cartopy does, so for Greenland 42W should be specified as -42 instead.

    import cartopy.crs as ccrs
    import matplotlib.pyplot as plt
    
    projection = ccrs.Stereographic(central_latitude=70, central_longitude=-42)
    
    fig, ax = plt.subplots(
        figsize=(6, 12), facecolor="w",
        subplot_kw=dict(projection=projection),
    )
    
    ax.coastlines()
    ax.gridlines(draw_labels=True)
    ax.set_extent((-65, -15, 58, 84), crs=ccrs.PlateCarree())
    

    enter image description here