mathause / mplotutils

helper functions for cartopy and matplotlib
MIT License
18 stars 3 forks source link

enable set_map_layout for subfigures #102

Closed mathause closed 2 months ago

mathause commented 7 months ago

I doubt this is possible. Currently subfigs can only have relative sizes, and it seems not possible to change them after the fact. Also the can be nested or vertical (I guess it would only work if they would span the whole width of the figure).

%matplotlib

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

f = plt.figure()

sf1, sf2 = f.subfigures(2, 1)

axs = sf1.subplots(1, 2, subplot_kw={"projection": ccrs.Robinson()})
sf1.set_facecolor("0.5")
sf1.canvas.draw()

# errors
# mpu.set_map_layout(axs)
mathause commented 6 months ago

Maybe just raise an error?