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

ConnectionPath with fancy arrow of length zero produces no plot #3930

Closed
eyurtsev opened this issue Dec 17, 2014 · 2 comments
Closed

ConnectionPath with fancy arrow of length zero produces no plot #3930

eyurtsev opened this issue Dec 17, 2014 · 2 comments
Labels
Difficulty: Medium https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues
Milestone

Comments

@eyurtsev
Copy link
Contributor

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

@mdboom
Copy link
Member

mdboom commented Dec 18, 2014

@leejjoon: I think this might be your area?

@tacaswell tacaswell added this to the v1.4.x milestone Dec 22, 2014
@tacaswell
Copy link
Member

I suspect that this just needs the expander logic that is scattered else where through out the code (thinking in particular of the hex-bin range logic when min(d) == max(d)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty: Medium https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues
Projects
None yet
Development

No branches or pull requests

4 participants