healpy.newvisufunc.newprojplot¶
- healpy.newvisufunc.newprojplot(theta, phi, fmt=None, lonlat=False, **kwargs)¶
newprojplot is a wrapper around
matplotlib.Axes.plot()to support colatitude theta and longitude phi and take into account the longitude convention (see the flip keyword ofprojview())You can call this function as:
newprojplot(theta, phi) # plot a line going through points at coord (theta, phi) newprojplot(theta, phi, 'bo') # plot 'o' in blue at coord (theta, phi)
- Parameters:
- theta, phifloat, array-like
Angular coordinates of a point on the sphere
- fmtstr
A format string (see
matplotlib.Axes.plot()for details)- lonlatbool, optional
If True, input angles are assumed to be longitude and latitude in degree, otherwise, they are co-latitude and longitude in radians.
Notes
Other keywords are passed to
matplotlib.Axes.plot().When adding a legend to plots created with geographic projections (e.g., mollweide, hammer, aitoff), you must specify an explicit location to avoid performance issues. For example:
newprojplot(theta, phi, label='my data') plt.legend(loc='upper right') # Must specify loc explicitly
Do not use
plt.legend()without thelocparameter, as the automatic positioning algorithm can be extremely slow or hang with geographic projections.