Alejandro Weinstein
2015-10-29 16:07:16 UTC
Hi,
I have a previously draw plot that I want to place as an inset in
another figure. I've tried with passing the previously drawn axes as
the `axes` parameter to the `add_axes` method of the figure, and also
tried using the `set_axes` method of the new axes, without success: I
get the new inset axes, but without the previously drawn plot, in both
cases.
The following code shows both approaches:
# Passing the inset axes as a parameter to add_axes
fig_in, ax_in = plt.subplots()
ax_in.plot([1,2,3])
fig, ax = plt.subplots()
ax.plot([1,2,1])
fig.add_axes([0.72, 0.72, 0.16, 0.16], axes=ax_in)
# Using set_axes
fig_in, ax_in = plt.subplots()
ax_in.plot([1,2,3])
fig, ax = plt.subplots()
ax.plot([1,2,1])
ax_new = fig.add_axes([0.72, 0.72, 0.16, 0.16])
ax_new.set_axes(ax_in)
Any help with this will be appreciated.
Regards,
Alejandro
------------------------------------------------------------------------------
I have a previously draw plot that I want to place as an inset in
another figure. I've tried with passing the previously drawn axes as
the `axes` parameter to the `add_axes` method of the figure, and also
tried using the `set_axes` method of the new axes, without success: I
get the new inset axes, but without the previously drawn plot, in both
cases.
The following code shows both approaches:
# Passing the inset axes as a parameter to add_axes
fig_in, ax_in = plt.subplots()
ax_in.plot([1,2,3])
fig, ax = plt.subplots()
ax.plot([1,2,1])
fig.add_axes([0.72, 0.72, 0.16, 0.16], axes=ax_in)
# Using set_axes
fig_in, ax_in = plt.subplots()
ax_in.plot([1,2,3])
fig, ax = plt.subplots()
ax.plot([1,2,1])
ax_new = fig.add_axes([0.72, 0.72, 0.16, 0.16])
ax_new.set_axes(ax_in)
Any help with this will be appreciated.
Regards,
Alejandro
------------------------------------------------------------------------------