Revision: 6178
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6178&view=rev
Author: efiring
Date: 2008-10-10 19:43:34 +0000 (Fri, 10 Oct 2008)
Log Message:
-----------
Permit chunking in the backend_agg draw_path() method.
This is experimental, and disabled by default; it can be enabled
by setting the rcParams['agg.path.chunksize'] before a path is
drawn.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
trunk/matplotlib/lib/matplotlib/rcsetup.py
trunk/matplotlib/matplotlibrc.template
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2008-10-10
16:53:27 UTC (rev 6177)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2008-10-10
19:43:34 UTC (rev 6178)
@@ -62,7 +62,7 @@
self._renderer = _RendererAgg(int(width), int(height), dpi,
debug=False)
if __debug__: verbose.report('RendererAgg.__init__ _RendererAgg done',
'debug-annoying')
- self.draw_path = self._renderer.draw_path
+ #self.draw_path = self._renderer.draw_path # see below
self.draw_markers = self._renderer.draw_markers
self.draw_path_collection = self._renderer.draw_path_collection
self.draw_quad_mesh = self._renderer.draw_quad_mesh
@@ -76,6 +76,28 @@
if __debug__: verbose.report('RendererAgg.__init__ done',
'debug-annoying')
+ def draw_path(self, gc, path, transform, rgbFace=None):
+ nmax = rcParams['agg.path.chunksize'] # here at least for testing
+ npts = path.vertices.shape[0]
+ if nmax > 100 and npts > nmax and path.should_simplify:
+ nch = npy.ceil(npts/float(nmax))
+ chsize = int(npy.ceil(npts/nch))
+ i0 = npy.arange(0, npts, chsize)
+ i1 = npy.zeros_like(i0)
+ i1[:-1] = i0[1:] - 1
+ i1[-1] = npts
+ for ii0, ii1 in zip(i0, i1):
+ v = path.vertices[ii0:ii1,:]
+ c = path.codes
+ if c is not None:
+ c = c[ii0:ii1]
+ c[0] = Path.MOVETO # move to end of last chunk
+ p = Path(v, c)
+ self._renderer.draw_path(gc, p, transform, rgbFace)
+ else:
+ self._renderer.draw_path(gc, path, transform, rgbFace)
+
+
def draw_mathtext(self, gc, x, y, s, prop, angle):
"""
Draw the math text using matplotlib.mathtext
Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/rcsetup.py 2008-10-10 16:53:27 UTC (rev
6177)
+++ trunk/matplotlib/lib/matplotlib/rcsetup.py 2008-10-10 19:43:34 UTC (rev
6178)
@@ -488,7 +488,10 @@
'svg.embed_char_paths' : [True, validate_bool], # True to save all
characters as paths in the SVG
'plugins.directory' : ['.matplotlib_plugins', str], # where plugin
directory is locate
- 'path.simplify' : [False, validate_bool]
+ 'path.simplify' : [False, validate_bool],
+ 'agg.path.chunksize' : [0, validate_int] # 0 to disable chunking;
+ # recommend about 20000 to
+ # enable. Experimental.
}
if __name__ == '__main__':
Modified: trunk/matplotlib/matplotlibrc.template
===================================================================
--- trunk/matplotlib/matplotlibrc.template 2008-10-10 16:53:27 UTC (rev
6177)
+++ trunk/matplotlib/matplotlibrc.template 2008-10-10 19:43:34 UTC (rev
6178)
@@ -270,6 +270,16 @@
### CONTOUR PLOTS
#contour.negative_linestyle : dashed # dashed | solid
+### Agg rendering
+### Warning: experimental, 2008/10/10
+#agg.path.chunksize : 0 # 0 to disable; values in the range
+ # 10000 to 100000 can improve speed slightly
+ # and prevent an Agg rendering failure
+ # when plotting very large data sets,
+ # especially if they are very gappy.
+ # It may cause minor artifacts, though.
+ # A value of 20000 is probably a good
+ # starting point.
### SAVING FIGURES
#path.simplify : False # When True, simplify paths in vector backends, such
as PDF, PS and SVG
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins