API
AlgebraOfGraphics.AxisEntries
AlgebraOfGraphics.density
AlgebraOfGraphics.density
AlgebraOfGraphics.expectation
AlgebraOfGraphics.expectation
AlgebraOfGraphics.frequency
AlgebraOfGraphics.frequency
AlgebraOfGraphics.histogram
AlgebraOfGraphics.histogram
AlgebraOfGraphics.iscontinuous
AlgebraOfGraphics.linear
AlgebraOfGraphics.linear
AlgebraOfGraphics.linesfill
AlgebraOfGraphics.linesfill!
AlgebraOfGraphics.nonnumeric
AlgebraOfGraphics.nonnumeric
AlgebraOfGraphics.plottypes_attributes
AlgebraOfGraphics.renamer
AlgebraOfGraphics.renamer
AlgebraOfGraphics.smooth
AlgebraOfGraphics.smooth
AlgebraOfGraphics.sorter
AlgebraOfGraphics.sorter
AlgebraOfGraphics.to_entry
AlgebraOfGraphics.AxisEntries
โ TypeAxisEntries(axis::Union{Axis, Nothing}, entries::Vector{Entry}, labels, scales)
Define all ingredients to make plots on an axis. Each scale can be either a CategoricalScale
(for discrete collections), such as CategoricalScale(["a", "b"], ["red", "blue"])
, or a function, such as log10
. Other scales may be supported in the future.
AlgebraOfGraphics.density
โ Methoddensity(; extrema, npoints, kernel, bandwidth)
Fit a kernel density estimation of data
.
AlgebraOfGraphics.expectation
โ Methodexpectation(args...)
Compute the expected value of the last argument conditioned on the preceding ones.
AlgebraOfGraphics.frequency
โ Methodfrequency()
Compute a frequency table of the arguments.
AlgebraOfGraphics.histogram
โ Methodhistogram(; 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
.
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.iscontinuous
โ Methodiscontinuous(v)
Determine whether v
should be treated as a continuous or categorical vector.
AlgebraOfGraphics.linear
โ Methodlinear(; 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!
โ Methodlinesfill(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
โ Methodlinesfill(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 Makie.Automatic()
fillalpha 0.15
linestyle "nothing"
linewidth 1.5
lower Makie.Automatic()
upper Makie.Automatic()
AlgebraOfGraphics.nonnumeric
โ Methodnonnumeric(x)
Transform x
into a non numeric type that is printed and sorted in the same way.
AlgebraOfGraphics.plottypes_attributes
โ Methodplottypes_attributes(entries)
Return plottypes and relative attributes, as two vectors of the same length, for the given entries
.
AlgebraOfGraphics.renamer
โ Methodrenamer(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 Pair
s, 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
โ Methodsmooth(span=0.75, degreee=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
โ Methodsorter(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.
AlgebraOfGraphics.to_entry
โ Methodto_entry(layer::Layer)
Convert layer
to equivalent entry, excluding transformations.