Patch for uninitialized vertices in Path.arc

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.richard@...991...>
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