Hello,

may I suggest two enhancements for the upcoming matplotlib 1.0 release.

The first is related to bug #3011650 and fix r8379.
http://matplotlib.svn.sourceforge.net/viewvc/matplotlib?view=revision&revision=8379

Texmanager.py, which is imported during the import of matplotlib, does call subprocess.Popen('dvipng'...) on every import. This can significantly add to the startup time of scripts. Given that most scripts don't use TeX, can the Popen() call be deferred to runtime? On my system (Python 2.6 for Windows, mpl 1.0rc1, MiKTeX 2.8) the 'backend_driver.py agg' tests are run about 8% (20s) faster with the following patch.

Index: lib/matplotlib/texmanager.py
===================================================================
--- lib/matplotlib/texmanager.py        (revision 8481)
+++ lib/matplotlib/texmanager.py        (working copy)
@@ -91,7 +91,7 @@
     if not os.path.exists(texcache):
         os.mkdir(texcache)

-    _dvipng_hack_alpha = dvipng_hack_alpha()
+    _dvipng_hack_alpha = None

     # mappable cache of
     rgba_arrayd = {}
@@ -516,6 +516,8 @@
             if rcParams['text.dvipnghack'] is not None:
                 hack = rcParams['text.dvipnghack']
             else:
+                if self._dvipng_hack_alpha is None:
+                    self._dvipng_hack_alpha = dvipng_hack_alpha()
                 hack = self._dvipng_hack_alpha

             if hack:


The second enhancement, a quick fix for placing images of extreme aspect ratio, is to allow 'panchor' and 'fraction' arguments in colorbar().
http://sourceforge.net/tracker/?func=detail&aid=3016948&group_id=80706&atid=560723

Thanks,

Christoph
Index: lib/matplotlib/texmanager.py
===================================================================
--- lib/matplotlib/texmanager.py        (revision 8481)
+++ lib/matplotlib/texmanager.py        (working copy)
@@ -91,7 +91,7 @@
     if not os.path.exists(texcache):
         os.mkdir(texcache)

-    _dvipng_hack_alpha = dvipng_hack_alpha()
+    _dvipng_hack_alpha = None

     # mappable cache of
     rgba_arrayd = {}
@@ -516,6 +516,8 @@
             if rcParams['text.dvipnghack'] is not None:
                 hack = rcParams['text.dvipnghack']
             else:
+                if self._dvipng_hack_alpha is None:
+                    self._dvipng_hack_alpha = dvipng_hack_alpha()
                 hack = self._dvipng_hack_alpha

             if hack:
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to