Conversation
|
This sounds like it should be possible and I like the approach you've suggested for the skyregion plot api. The second issue, with the legend, sounds like a bug, and I don't understand it. |
|
@cdeil - if you are using WCSAxes, then |
|
@astrofrog - Thanks for the tip, implemented in 30eebc9 . If the current axis is a WCSAxes or one is passed in, calling plot on the sky region seems to work fine. I find this super convenient, it just does the right thing by default without having to pass the WCS all the time. @astrofrog @keflavich @sushobhana - Please review the API / implementation. Once it's clear what we want, I can add tests and docs. |
|
The approach you've taken looks fine, that's what I'd do. |
sushobhana
left a comment
There was a problem hiding this comment.
If there is a plot, there should be as_artist method for sky regions?
In #76 (I think) I argued to remove the
containsandplotmethod onSkyRegionobjects, 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
axhave a link to thewcswhen using wcsaxes, so that we can add a one-lineer in a methodSkyRegion.plotin the base class to make this work?Another issue I have with region plot is that if I call
PixRegion.plotand thenplt.legend, it never shows up in the legend. Only if I callregion.as_artistandax.add_artistdoes 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.