8000 ConnectionPath with fancy arrow of length zero produces no plot · Issue #3930 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
ConnectionPath with fancy arrow of length zero produces no plot #3930
Closed
@eyurtsev

Description

@eyurtsev

The following code produces no plot:

%pylab inline
from matplotlib.patches import ConnectionPatch
xy1 = (0.3, 0.3)
xy2 = (0.3, 0.3)
ax = gca()
con = ConnectionPatch(xyA=xy1, xyB=xy2, coordsA="data", coordsB="data",
                      arrowstyle='fancy', # <-- this is ok
                      axesA=ax, axesB=ax)
ax.add_artist(con)

It works fine if I change the arrowstyle to the default.

With arrowstyle='fancy', I get the following warnings:

/usr/local/lib/python2.7/dist-packages/matplotlib/patches.py:2960: RuntimeWarning: divide by zero encountered in double_scalars
ff = d / (dx * dx + dy * dy) ** .5
/usr/local/lib/python2.7/dist-packages/matplotlib/patches.py:2961: RuntimeWarning: invalid value encountered in double_scalars
x2, y2 = x0 - ff * dx, y0 - ff * dy

The problem is probably with FancyArrow:

%pylab inline
from matplotlib.patches import FancyArrow, FancyArrowPatch, Arrow

# Arrow is OKAY
p = Arrow(0.3, 0.3, 0, 0) 
gca().add_patch(p)

# FancyArrow gives a RuntimeWarning about invalid values. (likely division by zero)
p = FancyArrow(0.3, 0.3, 0, 0)
gca().add_patch(p)

running matplotlib 1.4.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty: Mediumhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issues

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0