I would like to create a figure with 2x2 subplots. Then with some input from the user (on a different thread), the figure changes to MxN group of sub plots without creating another figure box. Is this possible?
x = [1,2,3]
y = [1,2,3]
fig, axs = plt.subplots(222)
threadedPlotShow(ax, x, y) #in a different thread, shows figure with xy on each
#wait for user input
m = raw_input("enter rows")
n = raw_input("enter cols")
update_figure(x,y,M,N,fig)
def update_figure(self, x, y, M, N, fig):
ax=fig.add_subplot(nrows=M,ncols=N, index=M+N+1)
ax.plot(x,y)
plt.draw()
These posts do not help because it creates new figures (at least in my implementation, if they should't let me know and I will keep trying): Dynamically add/create subplots in matplotlib