Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In #76 (I think) I argued to remove the
contains
andplot
method onSkyRegion
objects, because it can be ambiguous how to transform the sky region to a pixel region and it's better to let the user be explicit:Now using it myself, and seeing others plot many regions in Gammapy, I find it annoying to have to do
sky_region.to_pix(wcs).plot(ax=ax)
all the time, and would prefersky_region.plot(ax=ax)
to work directly and do whatever DS9 does to plot, presumably already what ourto_pix(wcs).plot(ax=ax)
does.@astrofrog or anyone - is that possible? Does the
ax
have a link to thewcs
when using wcsaxes, so that we can add a one-lineer in a methodSkyRegion.plot
in the base class to make this work?Another issue I have with region plot is that if I call
PixRegion.plot
and thenplt.legend
, it never shows up in the legend. Only if I callregion.as_artist
andax.add_artist
does it show up in the legend. Does someone know if it's possible to plot regions and have them added to the legend in a simple way? Would be nice to extend the https://astropy-regions.readthedocs.io/en/latest/plotting.html page with an example.