I've been stumbling around this issue for a while, but today I really want to figure out if it can be done.
Say you have a function from a library that does some plotting, such as:
def plotting_function():
fig, ax = plt.subplots()
ax.plot([1,2,3], [2,4,10])
return fig
If I want to add this single plot multiple times to my own subplots, how could I do this?
I'm not able to change the plotting_function, as it's from a library, so what I've tried is:
fig, axs = plt.subplots(1,3)
for i in range(3):
plt.sca(axs[i])
plotting_function()
plt.show()
This results in an empty subplot with the line graphs plotting separate.
Is there any simple answer to this problem? Thanks in advance.