galpy.util.plot.dens2d

galpy.util.plot.dens2d(X, **kwargs)[source]

Plot a 2d density with optional contours.

Parameters:
  • X (numpy.ndarray) – The density to plot.

  • *args – Arguments for pyplot.imshow.

  • xlabel (str, optional) – x-axis label, LaTeX math mode, no $s needed.

  • ylabel (str, optional) – y-axis label, LaTeX math mode, no $s needed.

  • xrange (tuple, optional) – x range to plot over.

  • yrange (tuple, optional) – y range to plot over.

  • noaxes (bool, optional) – If True, don’t plot any axes.

  • overplot (bool, optional) – If True, overplot.

  • gcf (bool, optional) – If True, do not start a new figure.

  • colorbar (bool, optional) – If True, add colorbar.

  • shrink (float, optional) – Colorbar shrink factor.

  • conditional (bool, optional) – Normalize each column separately (for probability densities, i.e., cntrmass=True).

  • justcontours (bool, optional) – If True, only draw contours.

  • contours (bool, optional) – If True, draw contours (10 by default).

  • levels (numpy.ndarray, optional) – Contour levels.

  • cntrmass (bool, optional) – If True, the density is a probability and the levels are probability masses contained within the contour.

  • cntrcolors (str or list, optional) – Colors for contours (single color or array).

  • cntrlabel (bool, optional) – Label the contours.

  • cntrlw (float, optional) – Linewidths for contour.

  • cntrls (str, optional) – Linestyles for contour.

  • cntrlabelsize (float, optional) – Size of contour labels.

  • cntrlabelcolors (str, optional) – Color of contour labels.

  • cntrinline (bool, optional) – If True, put contour labels inline with contour.

  • cntrSmooth (float, optional) – Use ndimage.gaussian_filter to smooth before contouring.

  • retAxes (bool, optional) – Return all Axes instances.

  • retCont (bool, optional) – Return the contour instance.

Returns:

Plot to output device, Axes instances depending on input.

Return type:

Axes or tuple

Notes

  • 2010-03-09 - Written - Bovy (NYU)