pynbody.plot.generic.hist2d#
- pynbody.plot.generic.hist2d(xo, yo, weights=None, mass=None, gridsize=(100, 100), nbins=None, make_plot=True, **kwargs)[source]#
Plot 2D histogram for arbitrary arrays that get passed in.
Input:
x: array
y: array
Optional keywords:
- x_range: list, array, or tuple
size(x_range) must be 2. Specifies the X range.
- y_range: tuple
size(y_range) must be 2. Specifies the Y range.
- gridsize: (int, int) (default (100,100))
number of bins to use for the 2D histogram
- nbins: int
number of bins for the histogram - if specified, gridsize is set to (nbins,nbins)
- nlevels: int
number of levels to use for the contours
- logscale: boolean
whether to use log or linear spaced contours
- weights: numpy array of same length as x and y
if weights is passed, color corresponds to the mean value of weights in each cell
- mass: numpy array of masses same length as x andy
must also have weights passed in. If you just want to weight by mass, pass the masses to weights
- colorbar: boolean
draw a colorbar
- scalemin: float
minimum value to use for the color scale
- scalemax: float
maximum value to use for the color scale