From: Gökhan S. <gok...@gm...> - 2012-07-17 22:35:42
|
There is one issue I spotted in this code. Although hard to notice from the produced plot, only the latest grid is updated when set_ydata is called. So a slight modification makes this code running correctly as originally intended. L1list = [] L2list = [] for i in range(nums): for j in range(xx*16, xx*16+16): if i == 0: L1list.append(grid[j%16].plot(dd1, conc1[j], color='r', lw=1.5)[0]) L2list.append(grid[j%16].plot(dd2, conc2[j], color='b', lw=1.5)[0]) grid[j% 16].set_xscale('log') grid[j%16].set_xticks([10, 100, 1000]) grid[j%16]. set_yticks([-25, 0, 25]) grid[j%16].yaxis.set_minor_locator(ticker. MultipleLocator(5)) grid[j%16].set_xlim(1,2000, auto=False) grid[j%16]. set_ylim(-50,50, auto=False) else: L1list(j%16).set_ydata(conc1[j]) L2list(j%16).set_ydata(conc2[j]) On Thu, Jul 5, 2012 at 11:15 AM, Fabrice Silva <si...@lm...>wrote: > > > > At end of the outer loop, instead of closing the figure, you should > > call "remove()" for each plot element you made. Essentially, as you > > loop over the inner loop, save the output of the plot() call to a > > list, and then when done with those plots, pop each element of that > > list and call "remove()" to take it out of the subplot. This will let > > the subplot axes retain the properties you set earlier. > > Instead of remove()'ing the graphical elements, you can also reuse them > if the kind of plots you intend to do is the same along the figure > for simple plots. See : http://paste.debian.net/177857/ > > -- > Fabrice Silva > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Gökhan |