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

CompoundPixelRegion.plot() needs center #469

Open
robelgeda opened this issue Jul 14, 2022 · 0 comments
Open

CompoundPixelRegion.plot() needs center #469

robelgeda opened this issue Jul 14, 2022 · 0 comments

Comments

@robelgeda
Copy link

robelgeda commented Jul 14, 2022

Issue when trying to plot a compound region:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [66], in <cell line: 2>()
     68 chip_pixel_region = chip_region.to_pixel(wcs=wcs)
---> 69 chip_pixel_region.plot(fc='None', ec='blue', label=f"{region_catalog}", lw=4)

File ~/miniconda3/envs/astroconda/lib/python3.9/site-packages/regions/core/core.py:406, in PixelRegion.plot(self, origin, ax, **kwargs)
    403 if ax is None:
    404     ax = plt.gca()
--> 406 artist = self.as_artist(origin=origin, **kwargs)
    407 ax.add_artist(artist)
    409 return artist

File ~/miniconda3/envs/astroconda/lib/python3.9/site-packages/regions/core/compound.py:146, in CompoundPixelRegion.as_artist(self, origin, **kwargs)
    126 def as_artist(self, origin=(0, 0), **kwargs):
    127     """
    128     Return a matplotlib patch object for this region
    129     (`matplotlib.patches.PathPatch`).
   (...)
    144         A matplotlib patch object.
    145     """
--> 146     if (self.region1.center == self.region2.center
    147             and self.operator is op.xor):
    149         import matplotlib.patches as mpatches
    151         # set mpl_kwargs before as_artist is called on region1 and
    152         # region2

AttributeError: 'CompoundPixelRegion' object has no attribute 'center'

Region was made by taking the union of multiple regions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants