@@ -624,7 +624,8 @@ def plot(
624
624
missing_color : Optional [Union [str , Tuple [int , int , int ]]] = None ,
625
625
nan_color : Optional [Union [str , Tuple [int , int , int ]]] = None ,
626
626
alpha : float = 1. ,
627
- sigmas : Iterable [float ] = (1 ,),
627
+ sigmas : Iterable [float ] = [],
628
+ outline_sigmas : Iterable [float ] = [],
628
629
scatter_labels : Union [bool , dict ] = True ,
629
630
ax : Optional [Union [
630
631
'astropy.visualization.wcsaxes.WCSAxes' ,
@@ -718,6 +719,9 @@ def plot(
718
719
sigmas: Iterable[float], optional
719
720
The size of the error region about each point source to plot in units
720
721
of its error parameter sigma.
722
+ outline_sigmas: Iterable[float], optional
723
+ The size of the error region about each point source to plot as an
724
+ unfilled circle in units of its error parameter sigma.
721
725
scatter_labels: bool, optional
722
726
Whether to show labels for the scattered points. If ``True``, display
723
727
either their labels (if defined) or their indices within the
@@ -852,7 +856,7 @@ def plot(
852
856
from matplotlib .transforms import ScaledTranslation
853
857
from matplotlib .gridspec import SubplotSpec
854
858
from astropy .coordinates .sky_coordinate import SkyCoord
855
- from astropy .visualization .wcsaxes import WCSAxes
859
+ from astropy .visualization .wcsaxes import WCSAxes , SphericalCircle
856
860
from astropy .visualization .wcsaxes .frame import (
857
861
RectangularFrame ,
858
862
EllipticalFrame ,
@@ -962,11 +966,6 @@ def plot(
962
966
transform = ax .get_transform ('world' )
963
967
label_transform = transform + ScaledTranslation (N_X_OFFSET / 2 , N_Y_OFFSET / 2 ,
964
968
ax .figure .dpi_scale_trans )
965
- for pts in scatter :
966
- cm = pts .cmap ()
967
- for sigma in sigmas :
968
- ax .imshow (pts .render (projection , extent = sigma ), vmin = 0 , vmax = 1 ,
969
- cmap = cm )
970
969
for pts in scatter :
971
970
# Skip pts if it is empty, since you cannot have empty SkyCoords
972
971
if not pts .points :
@@ -980,7 +979,25 @@ def plot(
980
979
include &= (pts_y < ax .wcs .pixel_shape [1 ]+ .5 ) & (pts_y > .5 )
981
980
col = pts .rgba .to_hex (False )
982
981
ax .scatter (pts_x [include ], pts_y [include ], c = col , marker = pts .marker ,
983
- s = scatter_marker_size , label = pts .label , path_effects = outline )
982
+ s = scatter_marker_size , label = pts .label , path_effects = outline ,
983
+ zorder = 10 )
984
+
985
+ # plot the shaded error circles, if needed
986
+ cm = pts .cmap ()
987
+ for sigma in sigmas :
988
+ ax .imshow (pts .render (projection , extent = sigma ), vmin = 0 , vmax = 1 ,
989
+ cmap = cm , zorder = 5 )
990
+
991
+ # plot the error circle outlines, if needed
992
+ for outline_sigma in outline_sigmas :
993
+ for ra , dec , sigma , _ in pts .points :
994
+ coord = SkyCoord (ra * deg , dec * deg )
995
+ s = SphericalCircle (coord , sigma * outline_sigma * deg ,
996
+ edgecolor = col , facecolor = 'none' ,
997
+ transform = ax .get_transform ('icrs' ), zorder = 5 )
998
+ ax .add_patch (s )
999
+
1000
+ # plot the scatter labels, if needed
984
1001
if scatter_labels :
985
1002
for i , (r , d , * sl ) in enumerate (pts .points ):
986
1003
if not include [i ]:
@@ -995,6 +1012,7 @@ def plot(
995
1012
'color' : col ,
996
1013
'va' : 'bottom' ,
997
1014
'ha' : 'left' ,
1015
+ 'zorder' : 15
998
1016
}
999
1017
if not isinstance (scatter_labels , bool ):
1000
1018
kw .update (scatter_labels )
0 commit comments