astropy / pyregion

ds9 region parser for python
https://pyregion.readthedocs.io
MIT License
39 stars 40 forks source link

FancyArrowPatch has no property 'arrow_transmuter' nor 'connector' #143

Closed andresgur closed 3 years ago

andresgur commented 3 years ago

I got the error below when trying to plot the following ds9 object "# Region file format: DS9 version 4.1 global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 image line(38.895804,67.281904,58.411743,67.146864) # line=1 1 color=white width=2 font="helvetica 16 normal roman" text={3.9 arcsec or 80 pc}"

File "/home/agurpide/anaconda3/lib/python3.8/site-packages/pyregion/core.py", line 85, in get_mpl_patches_texts
    patches, txts = as_mpl_artists(self, properties_func,
  File "/home/agurpide/anaconda3/lib/python3.8/site-packages/pyregion/mpl_helper.py", line 343, in as_mpl_artists
    patches = [mpatches.FancyArrowPatch(posA=(x1, y1),
  File "/home/agurpide/anaconda3/lib/python3.8/site-packages/matplotlib/patches.py", line 3930, in __init__
    Patch.__init__(self, **kwargs)
  File "/home/agurpide/anaconda3/lib/python3.8/site-packages/matplotlib/patches.py", line 95, in __init__
    self.update(kwargs)
  File "/home/agurpide/anaconda3/lib/python3.8/site-packages/matplotlib/artist.py", line 996, in update
    raise AttributeError(f"{type(self).__name__!r} object "
AttributeError: 'FancyArrowPatch' object has no property 'arrow_transmuter'

after removing the property 'arrow_transmuter' from mpl_helper.py line 346, I still got the same error but with the 'connector' property. Might be that these two attributes are not longer supported in FancyArrowPatch? After removing these two properties the code worked fine. ` reg_string = open(region, "r").read() regs = pyregion.parse(reg_string).as_imagecoord(fits[0].header)

    patch_list, artist_list = regs.get_mpl_patches_texts()
    for p in patch_list:
        ax.add_patch(p)

    for t in artist_list:
        `ax.add_artist(t)``
revoltek commented 3 years ago

I confirm the bug and the solution