Binning2D.Binning2DModule

A lightweight package for grouping 2D data into regular bins.

Primarily for plotting, but note that this package does not contain any plotting code, just calculations.

Binning2D.EllipseType

Representation of an ellipse.

  • center: center

  • d1: conjugate axis 1

  • d2: conjugate axis 2

Parametrically, the ellipse is the points @. center + d1 * cos(θ) + d2 * sin(θ) for real numbers θ.

Binning2D.PointType

Representation of a point, for internal use. Use point to construct.

Binning2D.binFunction

bin(bin, xy)

Find the bin that contains xy in grid.

The return value is opaque and should be used in conjuction with grid.

Valid values for xy are 2-element tuples and AbstractVectors, SVector{2} is preferred.

Binning2D.bin_areaMethod
bin_area(grid)

bin_area(T, grid)

Calculate the area of a bin in grid using type T (default = Float64).

Note: all bins in a grid have the same area.

Binning2D.bin_bivariateMethod
bin_bivariate(x, x_boundaries, y, y_boundaries)

Bin bivariate data x, y using the given boundaries.

Return a BinnedBivariate object. See get_x_y_w.

Binning2D.circleMethod
circle(center, r)

Convenience function to create a circle. Internal.

Binning2D.get_x_y_wMethod
get_x_y_w(bb; threshold, scale)

Return an iterator that yields (x, y, w) triplets, keeping only w ≥ threshold.

When threshold == 0, ws sum to 1, but this is not maintained. The purpose is to remove outliers for plots, with threshold = 1e-3 or similar.

Binning2D.inner_ellipseMethod
inner_ellipse(grid, bin)

inner_ellipse(T, grid, bin)

Return the Ellipse that can be inscribed into a bin.

Uses element type T (default = Float64).

Binning2D.nice_quantilesMethod
nice_quantiles(xs, N; relative_threshold)

Make “nice” quantile boundaries from univariate data, using the following algorithm:

  1. quantiles 1/(N+1), 2/(N+1), …, N/(N+1) are calculated

  2. for quantiles which are closer than (maximum(x) - minimum(x)) * relative_threshold,

only one is kept

This algorithm is a heuristic designed for binning data that may pile up at various locations (edges etc).

Binning2D.pointMethod
point(x, y)

Convenience function to construct a point from two coordinates. Internal.

Binning2D.verticesMethod
vertices(grid, bin)

vertices(T, grid, bin)

Return the vertices of bin in grid as a Tuple of coordinates (xy pairs).

Uses element type T (default = Float64).