`Binning2D.Binning2D`

— ModuleA 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.Ellipse`

— TypeRepresentation 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.Point`

— TypeRepresentation of a point, for internal use. Use `point`

to construct.

`Binning2D.RectangleBin`

— TypeThe rectangle $x ± 0.5, y ± 0.5$.

`Binning2D.RectangleGrid`

— TypeA grid of rectangles with area 1, centered on the origin.

`Binning2D.bin`

— Functionbin(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 `AbstractVector`

s, SVector{2} is preferred.

`Binning2D.bin_area`

— Method```
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_bivariate`

— Method```
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.circle`

— Method```
circle(center, r)
```

Convenience function to create a circle. Internal.

`Binning2D.get_x_y_w`

— Method```
get_x_y_w(bb; threshold, scale)
```

Return an iterator that yields `(x, y, w)`

triplets, keeping only `w ≥ threshold`

.

When `threshold == 0`

, `w`

s sum to 1, but this is not maintained. The purpose is to remove outliers for plots, with `threshold = 1e-3`

or similar.

`Binning2D.inner_ellipse`

— Method```
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_quantiles`

— Method```
nice_quantiles(xs, N; relative_threshold)
```

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

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

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.point`

— Method```
point(x, y)
```

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

`Binning2D.vertices`

— Method```
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`

).