plotutils

dragons.plotutils.density_contour(xdata, ydata, bins, ax, label=True, smooth=0.0, clabel_kwargs={}, **contour_kwargs)[source]

Create a density contour plot.

Code modified from: https://gist.github.com/adrn/3993992#file-density_contour-py

Parameters:
  • xdata (ndarray)

  • ydata (ndarray)

  • bins (int or list) – Number of bins [nbins_x, nbins_y]. If int then nbins_x=nbins_y=nbins.

  • ax (matplotlib.axes.AxesSubplot) – Axis to draw contours on

  • label (bool) – Draw labels on the contours? (default: True)

  • smooth (float) – Smooth the contours by a gaussian filter with given standard deviation (default: 0.0)

  • clabel_kwargs (dict) – kwargs to be passed to pyplot.clabel() (default: {})

  • **contour_kwargs (dict) – kwargs to be passed to pyplot.contour()

Returns:

contour

Return type:

matplotlib.contour.QuadContourSet