On Thu, Jul 5, 2012 at 1:45 PM, Gökhan Sever <gokhanse...@gmail.com> wrote:
>
>
> On Thu, Jul 5, 2012 at 11:15 AM, Fabrice Silva <si...@lma.cnrs-mrs.fr>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/
>
>
> I was close to getting the script run as you pasted. (One minor correction
> in your script is indexing L1 and L2, either L1[0] or L1, (comma) required
> in the assignments since grid.plot returns a list) The key here was "reuse"
> as you told. Memory consumption almost drops to half comparing to the
> test_speed2.py script run. Now I am down to ~1 minutes from about ~4
> minutes execution times, which is indeed quite significant, provided that I
> experiment on 6 such 38 pages plots.
>
> nums = 2
> I1 time run test_speed3.py
> CPU times: user 8.19 s, sys: 0.07 s, total: 8.26 s
> Wall time: 8.49 s
>
> nums=38
> I1 time run test_speed3.py
> CPU times: user 78.84 s, sys: 0.19 s, total: 79.03 s
> Wall time: 80.88 s
>
> Thanks Fabrice for your feedback.
>
>
38 * 16 = 608
80 / 608 = 0.1316 seconds per plot
At this point, I doubt you are going to get much more speed-ups. Glad to
be of help!
Fabrice -- Good suggestion! I should have thought of that given how much I
use that technique in doing animation.
Ben Root
------------------------------------------------------------------------------
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users