Skip to content
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

Super short lines with arrows do not act well #4911

Merged
merged 1 commit into from
Aug 14, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions lib/matplotlib/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -3308,7 +3308,9 @@ def transmute(self, path, mutation_size, linewidth):
x0, y0 = path.vertices[0]
x1, y1 = path.vertices[1]

if self.beginarrow:
# If there is no room for an arrow and a line, then skip the arrow
hasBeginArrow = self.beginArrow and not ((x0==x1) and (y0==y1))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spelling error, should be lower case beginarrow

Can you use has_begin_arrow for the local variable instead of camel case please?

Probably the same thing with endarrow

if hasBeginArrow:
verticesA, codesA, ddxA, ddyA = \
self._get_arrow_wedge(x1, y1, x0, y0,
head_dist, cos_t, sin_t,
Expand All @@ -3321,7 +3323,9 @@ def transmute(self, path, mutation_size, linewidth):
x2, y2 = path.vertices[-2]
x3, y3 = path.vertices[-1]

if self.endarrow:
# If there is no room for an arrow and a line, then skip the arrow
hasEndArrow = self.endArrow and not ((x2==x3) and (y2==y3))
if hasEndArrow:
verticesB, codesB, ddxB, ddyB = \
self._get_arrow_wedge(x2, y2, x3, y3,
head_dist, cos_t, sin_t,
Expand All @@ -3338,7 +3342,7 @@ def transmute(self, path, mutation_size, linewidth):
path.codes)]
_fillable = [False]

if self.beginarrow:
if hasBeginArrow:
if self.fillbegin:
p = np.concatenate([verticesA, [verticesA[0],
verticesA[0]], ])
Expand All @@ -3349,7 +3353,7 @@ def transmute(self, path, mutation_size, linewidth):
_path.append(Path(verticesA, codesA))
_fillable.append(False)

if self.endarrow:
if hasEndArrow:
if self.fillend:
_fillable.append(True)
p = np.concatenate([verticesB, [verticesB[0],
Expand Down