Hi,
 
Using matplotlib.path.Path.arc to create a wedge (e.g. via 
matplotlib.path.Path.wedge) creates a Path with three uninitialized vertex 
positions. (The first one and the last two.)
 
As you would expect - sometimes this leads to nasty drawing artifacts!
 
I've tried zeroing the entire array and a couple of ways to just zero the 
offending vertices, but they all have equal performance, so I've gone with 
zeroing the entire array. It has the simplest, cleanest code, and will be more 
robust to future changes.
 
Regards
Richard Hattersley
 
 
--------------- patch follows ----------------------- 
 
>From 6f5d9f71d1d56d80c0c1764268a6ddfc3f653f44 Mon Sep 17 00:00:00 2001
From: Richard Hattersley <hattersley.rich...@btconnect.com>
Date: Mon, 18 Jul 2011 14:20:16 +0100
Subject: [PATCH] Fix uninitialized vertices in Path.arc() for wedges.
---
 lib/matplotlib/path.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/matplotlib/path.py b/lib/matplotlib/path.py
index da37d7d..d5461b0 100644
--- a/lib/matplotlib/path.py
+++ b/lib/matplotlib/path.py
@@ -621,7 +621,7 @@ class Path(object):
         if is_wedge:
             length = n * 3 + 4
-            vertices = np.empty((length, 2), np.float_)
+            vertices = np.zeros((length, 2), np.float_)
             codes = cls.CURVE4 * np.ones((length, ), cls.code_type)
             vertices[1] = [xA[0], yA[0]]
             codes[0:2] = [cls.MOVETO, cls.LINETO]
--
1.7.6
 

------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to