I am trying to plot spherical circles in galactic coordinates using the SphericalCircle module in astropy. I'm having trouble wrapping galactic longitude angles between (-180, 180) degrees instead of the default (0, 360) degrees. Below is an example of what I'm trying to do.
import numpy as np
import matplotlib.pyplot as plt
from astropy import units as u
from astropy.coordinates import SkyCoord
from matplotlib.collections import PatchCollection
from astropy.visualization.wcsaxes import SphericalCircle
glat = np.random.uniform(-90, 90, 100)
glong = np.random.uniform(-180, 180, 100)
data = np.column_stack((glong, glat))
gal = SkyCoord(l = data[:,0] * u.deg, b = data[:,1] * u.deg, frame='galactic')
gal_long = gal.l.wrap_at(180*u.deg).deg
fig,ax = plt.subplots(1)
all_beams = []
for i in range(len(gal)):
beam = SphericalCircle(center=(gal_long[i] * u.deg, gal[i].b.deg * u.deg), \
radius = 7*u.arcmin, facecolor="None", edgecolor="black", linewidth=2)
all_beams.append(beam)
pc = PatchCollection(all_beams, match_original=False, lw=3, facecolor='white',
edgecolor='k')
ax.add_collection(pc)
ax.set_xlim(-180,360)
ax.set_ylim(-90,90)
plt.show()
Update1: Adding More Details. The line gal_long = gal.l.wrap_at(180*u.deg).deg wraps longitude between (-180, 180) but it looks like SphericalCircle by default changes it back to (0, 360). Is there a way to force SphericalCircle to return circles in the (-180, 180) convention?