Hi,

Trying to figure out why these two do not create the same plot. Bug or user
error?

import matplotlib.pyplot as plt
from matplotlib.patches import FancyArrowPatch
from matplotlib.collections import PatchCollection

def correct_patch(pos):
    fig, ax = plt.subplots()
    for src, dst in pos:
        arrow = FancyArrowPatch(posA=src, posB=dst,
                                color='k', arrowstyle='-|>',
                                mutation_scale=30, connectionstyle="arc3")
        ax.add_patch(arrow)
    return fig

def patch_collection_problem(pos):
    fig, ax = plt.subplots()
    pos = [[(.5, .5), (.25, .25)],
           [(.1, .5), (.2, .75)]]
    arrows = []
    for src, dst in pos:
        arrows.append(FancyArrowPatch(posA=src, posB=dst,
                                color='k', arrowstyle='-|>',
                                mutation_scale=30, connectionstyle="arc3"))
    collection = PatchCollection(arrows, match_original=True)

    ax.add_collection(collection, autolim=False)
    return fig

pos = [[(.5, .5), (.25, .25)],
          [(.1, .5), (.2, .75)]]

correct_patch(pos)
patch_collection_problem(pos)
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to