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

Plot region exported from CARTA #577

Open
HealthyPear opened this issue Nov 18, 2024 · 0 comments
Open

Plot region exported from CARTA #577

HealthyPear opened this issue Nov 18, 2024 · 0 comments

Comments

@HealthyPear
Copy link

HealthyPear commented Nov 18, 2024

I created a region file from CARTA v4.1.0 and I want to superimpose it to a radio map which "I load from FITS and from which I get the WCS.

What I am doing is this,

fig, ax = plt.subplots(subplot_kw={"projection": radio_data_wcs})

template_region = Regions.read("my_carta_region", format="crtf").regions[0]

pixel_region = template_region.to_pixel(radio_data_wcs)
pixel_region.plot()

plt.show()

I get the following error,

Traceback (most recent call last):
  File "plot_region_over_radio_data.py", line 47, in <module>
    pixel_region.plot()
  File "xxx/python3.12/site-packages/regions/core/core.py", line 446, in plot
    artist = self.as_artist(origin=origin, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "xxx/python3.12/site-packages/regions/shapes/ellipse.py", line 209, in as_artist
    return Ellipse(xy=xy, width=width, height=height, angle=angle,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "xxx/python3.12/site-packages/matplotlib/patches.py", line 1542, in __init__
    super().__init__(**kwargs)
  File "xxx/python3.12/site-packages/matplotlib/patches.py", line 83, in __init__
    self.set_edgecolor(edgecolor)
  File "xxx/python3.12/site-packages/matplotlib/patches.py", line 338, in set_edgecolor
    self._set_edgecolor(color)
  File "xxx/python3.12/site-packages/matplotlib/patches.py", line 324, in _set_edgecolor
    self._edgecolor = colors.to_rgba(color, self._alpha)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "xxx/python3.12/site-packages/matplotlib/colors.py", line 302, in to_rgba
    rgba = _to_rgba_no_colorcycle(c, alpha)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "xxx/python3.12/site-packages/matplotlib/colors.py", line 384, in _to_rgba_no_colorcycle
    raise ValueError(f"Invalid RGBA argument: {orig_c!r}")
ValueError: Invalid RGBA argument: '2ee6d6'

If I assume 2ee6d6 is the ID for an hex color, I attempt to specify the color with the proper # suffix and I get a new error,

Traceback (most recent call last):
  File "plot_region_over_radio_data.py", line 47, in <module>
    pixel_region.plot(edgecolor="#2ee6d6")
  File "xxx/python3.12/site-packages/regions/core/core.py", line 446, in plot
    artist = self.as_artist(origin=origin, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "xxx/python3.12/site-packages/regions/shapes/ellipse.py", line 209, in as_artist
    return Ellipse(xy=xy, width=width, height=height, angle=angle,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "xxx/site-packages/matplotlib/patches.py", line 1542, in __init__
    super().__init__(**kwargs)
  File "xxx/python3.12/site-packages/matplotlib/patches.py", line 98, in __init__
    self._internal_update(kwargs)
  File "xxx/site-packages/matplotlib/artist.py", line 1219, in _internal_update
    return self._update_props(
           ^^^^^^^^^^^^^^^^^^^
  File "xxx/python3.12/site-packages/matplotlib/artist.py", line 1193, in _update_props
    raise AttributeError(
AttributeError: Ellipse.set() got an unexpected keyword argument 'symsize'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant