python - multiple figures in matplotlib -


i new here , started python master thesis project. try plot multiple figures can't. have looked many same questions , answers still, can't result.

plt.figure(1) plt.draw() plt.axis([14,55, 3, 5]) plt.xlabel('doy') plt.ylabel('amplitudes of l1 & l2 signals') red_dot, = plt.plot(x1, l1,'ro') green_dot, = plt.plot(x1, l2, 'go') plt.legend([red_dot, green_dot], ["l1", "l2"])    plt.figure(2) plt.draw()  plt.axis([14,55, 25, 60]) plt.xlabel('doy') plt.ylabel('dampenings of l1 & l2 signals') red_dot, = plt.plot(x1, damp_l1,'ro') green_dot, = plt.plot(x1, damp_l2, 'go') plt.legend([red_dot, green_dot], ["dampening of l1", "dampening of l2"])   plt.show() 

this have written , thing figure 1 first plot , empty figure2 window no data inside!' can help?

thanks

i suggest using oo interface as possible (instead of pyplot 'state machine' api). want like:

fig1, ax1 = plt.subplots() fig2, ax2 = plt.subplots()  ax1.plot(x, y, 'ro')  ax2.plot(x, y, 'go') 

running these commands ipython session (after doing %matplotlib) give 2 interactive figures play with.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -