Skip to content

arrow_bug #559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 27, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions lib/matplotlib/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ def set_closed(self, closed):
def get_xy(self):
return self._path.vertices
def set_xy(self, vertices):
self._path = Path(vertices)
self._path = Path(vertices, closed=self._closed)
_get_xy = get_xy
_set_xy = set_xy
xy = property(
Expand Down Expand Up @@ -871,7 +871,8 @@ def __str__(self):
[ 0.0, 0.1 ], [ 0.0, -0.1],
[ 0.8, -0.1 ], [ 0.8, -0.3],
[ 1.0, 0.0 ], [ 0.8, 0.3],
[ 0.8, 0.1 ], [ 0.0, 0.1] ] )
[ 0.8, 0.1 ], [ 0.0, 0.1] ],
closed=True)

@docstring.dedent_interpd
def __init__( self, x, y, dx, dy, width=1.0, **kwargs ):
Expand Down Expand Up @@ -979,7 +980,7 @@ def __init__(self, x, y, dx, dy, width=0.001, length_includes_head=False, \
M = np.array([[cx, sx],[-sx,cx]])
verts = np.dot(coords, M) + (x+dx, y+dy)

Polygon.__init__(self, map(tuple, verts), **kwargs)
Polygon.__init__(self, map(tuple, verts), closed=True, **kwargs)

docstring.interpd.update({"FancyArrow":FancyArrow.__init__.__doc__})

Expand Down Expand Up @@ -1051,7 +1052,7 @@ def get_path(self):
xs = self.convert_xunits([xb1, xb2, xc2, xd2, x1, xd1, xc1, xb1])
ys = self.convert_yunits([yb1, yb2, yc2, yd2, y1, yd1, yc1, yb1])

return Path(zip(xs, ys))
return Path(zip(xs, ys), closed=True)

def get_patch_transform(self):
return transforms.IdentityTransform()
Expand Down Expand Up @@ -3696,18 +3697,18 @@ def set_dpi_cor(self, dpi_cor):
dpi_cor is currently used for linewidth-related things and
shink factor. Mutation scale is not affected by this.
"""

self._dpi_cor = dpi_cor

def get_dpi_cor(self):
"""
dpi_cor is currently used for linewidth-related things and
shink factor. Mutation scale is not affected by this.
"""

return self._dpi_cor


def set_positions(self, posA, posB):
""" set the begin end end positions of the connecting
path. Use current vlaue if None.
Expand Down Expand Up @@ -3905,7 +3906,7 @@ def draw(self, renderer):

# FIXME : dpi_cor is for the dpi-dependecy of the
# linewidth. There could be room for improvement.
#
#
#dpi_cor = renderer.points_to_pixels(1.)
self.set_dpi_cor(renderer.points_to_pixels(1.))
path, fillable = self.get_path_in_displaycoord()
Expand Down Expand Up @@ -4167,7 +4168,7 @@ def get_path_in_displaycoord(self):
"""

dpi_cor = self.get_dpi_cor()

x, y = self.xy1
posA = self._get_xy(x, y, self.coords1, self.axesA)

Expand Down
7 changes: 6 additions & 1 deletion lib/matplotlib/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Path(object):

code_type = np.uint8

def __init__(self, vertices, codes=None, _interpolation_steps=1):
def __init__(self, vertices, codes=None, _interpolation_steps=1, closed=False):
"""
Create a new path with the given vertices and codes.

Expand Down Expand Up @@ -117,6 +117,11 @@ def __init__(self, vertices, codes=None, _interpolation_steps=1):
assert len(codes) == len(vertices)
if len(codes):
assert codes[0] == self.MOVETO
elif closed:
codes = np.empty(len(vertices)) * 2
codes[0] = self.MOVETO
codes[1:-1] = self.LINETO
codes[-1] = self.CLOSEPOLY

assert vertices.ndim == 2
assert vertices.shape[1] == 2
Expand Down