Adding A Figure Created In A Function To Another Figure's Subplot
I created two functions that make two specific plots and returns me the respective figures: import matplotlib.pyplot as plt  x = range(1,100) y = range(1,100)  def my_plot_1(x,y):
Solution 1:
Eaiser and better to just pass your function an Axes:
def my_plot_1(x,y,ax):
    ax.plot(x,y)
def my_plot_2(x,y,ax):
    ax.plot(x,y)
fig, fig_axes = plt.subplots(ncols=2, nrows=1)
# pass the Axes you created above
my_plot_1(x, y, fig_axes[0])
my_plot_2(x, y, fig_axes[1])
Post a Comment for "Adding A Figure Created In A Function To Another Figure's Subplot"