`CompoundPixelRegion.plot()` needs center
- Dominant language
- Python
- Stars
- 65
- Forks
- 64
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 4
Description
Issue when trying to plot a compound region:
```
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Input In [66], in ()
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
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with CompoundPixelRegion.plot() and the as_artist() implementation in regions/core/compound.py, reproducing the union-of-regions example from the traceback. Check how the compound region is represented when plotting and verify that plotting a union no longer raises the reported AttributeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- matplotlib, python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100