Why does a frame around an image leave a corner incomplete?

Viewed 51

In the minimal example below, I'm trying to put a border around an image. But the bottom left corner remains blank. What does one need to do to fill it?

import matplotlib.pyplot as plt
import cartopy
import cartopy.crs as ccrs

plt.figure(figsize=(152, 90), dpi=10)
ax = plt.axes(projection=ccrs.PlateCarree(145))
land = cartopy.feature.NaturalEarthFeature('physical', 'land', scale='50m')
ocean = cartopy.feature.NaturalEarthFeature('physical', 'ocean', scale='50m')
ax.add_feature(land, facecolor='gray')
ax.add_feature(ocean, facecolor='black')
ax.patch.set_edgecolor('red')
ax.patch.set_linewidth('1000')  # exaggerated width for example
plt.savefig('islands.png', pad_inches=10)
plt.show()

Output:

Example image:

1 Answers

The default capstyle of the patch (which is a PathPatch) is 'butt', set it to 'projecting':

ax.patch.set_capstyle('projecting')

enter image description here

Related