Skip to content

Instantly share code, notes, and snippets.

View homerobse's full-sized avatar

Homero Barrocas Soares Esmeraldo homerobse

View GitHub Profile
@homerobse
homerobse / gist:d8b4cbaff3125f0404c77dc90c21abe0
Last active June 4, 2020 21:53
Snippet to add previously created axis to a figure
def add_ax_to_fig(ax, fig=None, geometry=(1,1,1)):
# def add_ax_to_fig(ax, fig=None, geometry="111"):
oldfig = ax.figure
if fig is None:
fig = figure()
if ax.get_geometry() != geometry:
ax.change_geometry(*geometry)
# if ax.get_position() != geometry:
# dummy = fig.add_subplot(geometry)
# ax.set_position(dummy.get_position())