It looks like you are storing your source data in a python list. Matplotlib 
runs much faster if you store your data using a numpy array instead. 

I'm no expert, but it certianly sped up my graph drawing.

-Tom



Message: 5
Date: Wed, 11 Nov 2009 08:53:58 -0600
From: Mike Anderson <mbander...@wisc.edu>
Subject: [Matplotlib-users] matplotlib slow compared to gnuplot?
To: matplotlib-users@lists.sourceforge.net
Message-ID: <ae4d4739-44be-43f2-9e56-daedbe990...@wisc.edu>
Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes

Hi all,

Previously I was a user of gnuplot but have been giving matplotlib a  
try.  One thing I've run in to right away is that matplotlib appears  
to be significantly slower.

A script to produce a dozen plots was taking me ~1 second with  
gnuplot, and now takes me ~18 seconds with matplotlib.

I'm curious if anyone knows how to speed things up.  To figure out  
what is taking most of the time, I've used cProfile and pstats and  
below is the top 15 functions taking the most time.
   (note: "plotStackedJobsVsTime" is my function that uses matplotlib.)

My script, for the curious, is at
   
http://www.hep.wisc.edu/cms/comp/routerqMonitor/prodJobMonitorPlots_matplotlib.py
and produces these plots:
   http://www.hep.wisc.edu/cms/comp/routerqMonitor/index.html


Any hints at what I can do to speed up my script?  Or is it out of my  
hands because it's all in matplotlib?

Thanks for any help,
Mike



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to