pynbody.plot.profile.density_profile

pynbody.plot.profile.density_profile#

pynbody.plot.profile.density_profile(sim, center=True, r_units=None, rho_units=None, rmin=None, rmax=None, nbins=50, bin_spacing='log', **kwargs)[source]#

Generate and plot a 3D density profile with error-bars.

This routine centers the simulation and generates a 3D density profile with error-bars. It then undoes the centering transformation before returning.

Changed in version 2.0: The transformation of the simulation is now reverted when the routine exits. Previously, the transformation was left in place.

The y-axis is no longer scaled to the critical density by default. Specify the units using the in_units keyword.

The x-axis is no longer scaled to kpc by default. Specify the units using the r_units keyword.

The clear, axes, filename, fit and fit_factor keywords have been removed for consistency with the rest of the plotting routines. Use the matplotlib functions directly to save the figure or modify the axes.

Parameters:
  • sim (pynbody.snapshot.SimSnap) – The simulation snapshot to be used.

  • center (bool, optional) – If True (default), the simulation is centered. If False, the simulation is assumed to be pre-centered.

  • r_units (str, optional) – The units in which to plot the radial axis. Default is None (no conversion).

  • rho_units (str, optional) – The units in which to plot the density axis. Default is None (no conversion).

  • rmin (float, optional) – The minimum radius to use in the profile. Default is the minimum radius in the simulation.

  • rmax (float, optional) – The maximum radius to use in the profile. Default is the maximum radius in the simulation.

  • nbins (int, optional) – The number of bins to use in the profile. Default is 50.

  • bin_spacing (str, optional) – The type of bin spacing to use in the profile. See Profile for details.

  • **kwargs (dict) – Additional keyword arguments are passed to matplotlib.pyplot.errorbar().