API

AlgebraOfGraphics.AxisEntries โ€” Type
AxisEntries(axis::Union{Axis, Nothing}, entries::Vector{Entry}, scales)

Define all ingredients to make plots on an axis. Each scale should be a CategoricalScale.

AlgebraOfGraphics.density โ€” Method
density(; datalimits, npoints, kernel, bandwidth)

Fit a kernel density estimation of data. Here, datalimits specifies the range for which the density should be calculated, npoints is the number of points used by Makie to draw the line and kernel and bandwidth are forwarded to KernelDensity.kde.

AlgebraOfGraphics.expectation โ€” Method
expectation(args...)

Compute the expected value of the last argument conditioned on the preceding ones.

AlgebraOfGraphics.histogram โ€” Method
histogram(; bins=automatic, weights=automatic, normalization=:none)

Compute a histogram. bins can be an Int to create that number of equal-width bins over the range of values. Alternatively, it can be a sorted iterable of bin edges. The histogram can be normalized by setting normalization. Possible values are:

  • :pdf: Normalize by sum of weights and bin sizes. Resulting histogram has norm 1 and represents a PDF.
  • :density: Normalize by bin sizes only. Resulting histogram represents count density of input and does not have norm 1.
  • :probability: Normalize by sum of weights only. Resulting histogram represents the fraction of probability mass for each bin and does not have norm 1.
  • :none: Do not normalize.

Weighted data is supported via the keyword weights.

Note

Normalizations are computed withing groups. For example, in the case of normalization=:pdf, sum of weights within each group will be equal to 1.

AlgebraOfGraphics.linear โ€” Method
linear(; interval)

Compute a linear fit of y ~ 1 + x. An optional named mapping weights determines the weights. Use interval to specify what type of interval the shaded band should represent. Valid values of interval are :confidence delimiting the uncertainty of the predicted relationship, and :prediction delimiting estimated bounds for new data points.

AlgebraOfGraphics.linesfill! โ€” Method
linesfill(xs, ys; lower, upper, kwargs...)

Line plot with a shaded area between lower and upper. If lower and upper are not given, shaded area is between 0 and ys.

Attributes

Available attributes and their defaults for Combined{AlgebraOfGraphics.linesfill!, T} where T are:

AlgebraOfGraphics.linesfill โ€” Method
linesfill(xs, ys; lower, upper, kwargs...)

Line plot with a shaded area between lower and upper. If lower and upper are not given, shaded area is between 0 and ys.

Attributes

Available attributes and their defaults for Combined{AlgebraOfGraphics.linesfill, T} where T are:

  color       :black
  colormap    :viridis
  colorrange  MakieCore.Automatic()
  fillalpha   0.15
  linestyle   "nothing"
  linewidth   1.5
  lower       MakieCore.Automatic()
  upper       MakieCore.Automatic()
AlgebraOfGraphics.renamer โ€” Method
renamer(arr::Union{AbstractArray, Tuple})

Utility to rename a categorical variable, as in renamer([value1 => label1, value2 => label2]). The keys of all pairs should be all the unique values of the categorical variable and the values should be the corresponding labels. The order of arr is respected in the legend.

Examples

julia> r = renamer(["class 1" => "Class One", "class 2" => "Class Two"])
AlgebraOfGraphics.Renamer{Vector{String}, Vector{String}}(["class 1", "class 2"], ["Class One", "Class Two"])

julia> println(r("class 1"))
Class One

Alternatively, a sequence of pair arguments may be passed.

julia> r = renamer("class 1" => "Class One", "class 2" => "Class Two")
AlgebraOfGraphics.Renamer{Tuple{String, String}, Tuple{String, String}}(("class 1", "class 2"), ("Class One", "Class Two"))

julia> println(r("class 1"))
Class One

If arr does not contain Pairs, elements of arr are assumed to be labels, and the unique values of the categorical variable are taken to be the indices of the array. This is particularly useful for dims mappings.

Examples

julia> r = renamer(["Class One", "Class Two"])
AlgebraOfGraphics.Renamer{Nothing, Vector{String}}(nothing, ["Class One", "Class Two"])

julia> println(r(2))
Class Two
AlgebraOfGraphics.smooth โ€” Method
smooth(span=0.75, degree=2)

Fit a loess model. span is the degree of smoothing, typically in [0,1]. Smaller values result in smaller local context in fitting. degree is the polynomial degree used in the loess model.

AlgebraOfGraphics.sorter โ€” Method
sorter(ks...)

Utility to reorder a categorical variable, as in sorter("low", "medium", "high"). ks should include all the unique values of the categorical variable. The order of ks is respected in the legend.