pynbody.plot.sph.contour

Contents

pynbody.plot.sph.contour#

pynbody.plot.sph.contour(sim, qty, width='10 kpc', resolution=None, units=None, axes=None, label=True, log=True, weight=None, contour_kwargs=None, smooth_min=0.0, _transform=None)[source]#

Create an image of the given quantity then turn it into contours.

Parameters:
  • sim (pynbody.snapshot.simsnap.SimSnap) – The simulation snapshot to plot. The image is generated in the plane z=0, or projected along the z axis.

  • qty (str | pynbody.array.SimArray) – The name of the array to interpolate. Default is ‘rho’, which gives a density image. Alternatively, an array can be passed in.

  • width (str or float, optional) – The overall width and height of the plot. If a float, it is assumed to be in units of sim[‘pos’]. It can also be passed in as a string indicating the units, e.g. ‘10 kpc’. (Default is ‘10 kpc’)

  • resolution (int, optional) – The number of pixels wide and tall. (Default is determined by the configuration file.)

  • units (str or pynbody.units.Unit, optional) – The units of the output. Default is None, in which case the units of the input quantity are used. If the units correspond to integrating the quantity along a spatial dimension, the output is a projected image. For example, if the units are ‘Msol kpc^-2’, and the quantity is ‘rho’, the output is a projected image of the surface density.

  • axes (matplotlib.axes.Axes, optional) – Axes instance on which the image will be shown; if None, the current pyplot figure is used. (Default is False)

  • label (bool, optional) – Whether to label the contours. (Default is True)

  • log (bool, optional) – If True, the image is log-scaled before being contoured. (Default is True)

  • weight (str, optional) – If set, the requested quantity is volume-averaged down the line of sight, weighted either by volume (if weight is True) or by a specified quantity. (Default is None)

  • contour_kwargs (dict, optional) – Additional keyword arguments to pass to the matplotlib contour function. (Default is None)

  • smooth_min (float, optional) –

    The minimum size of the smoothing kernel, either as a float or a unit string.

    Setting this to a non-zero value makes smoother, clearer contours but loses fine detail. Default is 0.0.

  • _transform (function, optional) – A function to apply to the image before contouring. (Default is None)