osyris.hist2d

Contents

osyris.hist2d#

osyris.hist2d(x, y, *layers, bins=256, mode=None, logx=False, logy=False, loglog=False, norm=None, filename=None, operation='sum', title=None, vmin=None, vmax=None, plot=True, ax=None, **kwargs)#

Plot a 2D histogram with two variables as input. When a vector quantity is supplied, the function will histogram the norm of the vectors.

Parameters:
  • x (Array) – Horizontal Array to be histogrammed.

  • y (Array) – Vertical Array to be histogrammed.

  • layers – Dicts or Arrays representing the quantities to be mapped onto the colormap of the generated image.

  • bins (int | Iterable | tuple) – The number of bins to use. Default is 256. Can also be an array of bin edges. If a single integer is passed, the bin edges are determined automatically. Can also be a tuple of two integers or arrays, representing the number of bins in the x and y directions.

  • mode (str | None) – The rendering mode for the histogram. Possible choices are 'image', 'contourf', 'contour', and 'scatter'. Default is None, which selects the render_mode set in the user configuration file ('image' by default).

  • logx (bool) – If True, use logarithmic scaling on the horizontal axis. Default is False.

  • logy (bool) – If True, use logarithmic scaling on the vertical axis. Default is False.

  • loglog (bool) – If True, use logarithmic scaling on the horizontal and vertical axes. Default is False.

  • norm (str | None) – The colormap normalization. Possible values are 'linear' and 'log'. Default is None (= 'linear').

  • filename (str | None) – If specified, the returned figure is also saved to file. Default is None.

  • operation (Literal['sum', 'mean']) – The operation to apply inside the bins of the histogram. Possible values are 'sum' and 'mean'. Default is 'sum'.

  • title (str | None) – The title of the figure. Default is None.

  • vmin (float | None) – Minimum value for colorbar range. Default is None.

  • vmax (float | None) – Maximum value for colorbar range. Default is None.

  • plot (bool) – Make a plot if True. If not, just return the Plot object containing the data that would be used to generate the plot. Default is True.

  • ax (object | None) – A matplotlib axes inside which the figure will be plotted. Default is None, in which case some new axes a created.

Return type:

Plot