`AlgebraOfGraphics.AbstractAlgebraic`

— Type`AbstractAlgebraic <: AbstractDrawable`

Abstract type encoding objects that can be combined together using `+`

and `*`

.

`AlgebraOfGraphics.AbstractDrawable`

— Type`AbstractDrawable`

Abstract type encoding objects that can be drawn via `AlgebraOfGraphics.draw`

.

`AlgebraOfGraphics.AxisEntries`

— Type`AxisEntries(axis::Union{Axis, Nothing}, entries::Vector{Entry}, categoricalscales, continuousscales)`

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

, and each continuous scale should be a `ContinuousScale`

.

`AlgebraOfGraphics.Entry`

— Type`Entry(plottype::PlotType, positional::Arguments, named::NamedArguments)`

Define plottype as well as positional and named arguments for a single plot.

`AlgebraOfGraphics.Layer`

— Type`Layer(transformation, data, positional::AbstractVector, named::AbstractDictionary)`

Algebraic object encoding a single layer of a visualization. It is composed of a dataset, positional and named arguments, as well as a transformation to be applied to those. `Layer`

objects can be multiplied, yielding a novel `Layer`

object, or added, yielding a `AlgebraOfGraphics.Layers`

object.

`AlgebraOfGraphics.Layers`

— Type`Layers(layers::Vector{Layer})`

Algebraic object encoding a list of `AlgebraOfGraphics.Layer`

objects. `Layers`

objects can be added or multiplied, yielding a novel `Layers`

object.

`AlgebraOfGraphics.ProcessedLayer`

— Method`ProcessedLayer(layer::Layer)`

Output of processing a `layer`

. A `ProcessedLayer`

encodes

- plot type,
- grouping arguments,
- positional and named arguments for the plot,
- labeling information,
- visual attributes.

`AlgebraOfGraphics.ProcessedLayers`

— Type`ProcessedLayers(layers::Vector{ProcessedLayer})`

Object encoding a list of `AlgebraOfGraphics.ProcessedLayer`

objects. `ProcessedLayers`

objects are the output of the processing pipeline and can be drawn without further processing.

`AlgebraOfGraphics.aog_theme`

— Method`aog_theme(; fonts=[firasans("Medium"), firasans("Light")])`

Return a `NamedTuple`

of theme settings. Intended for internal use. The provided functionality is exposed to the user by the function `set_aog_theme!`

.

`AlgebraOfGraphics.choropleth`

— Method`choropleth(geometries; transformation, attributes...)`

Choropleth map, where regions are defined by `geometries`

. Use `transformation`

to transform coordinates (see Proj.jl for more information).

The `transformation`

keyword argument is experimental and could be deprecated (even in a non-breaking release) in favor of a different syntax.

**Attributes**

Available attributes and their defaults for `MakieCore.Plot{AlgebraOfGraphics.choropleth}`

are:

```
alpha 1.0
color RGBA{Float32}(0.0f0,0.0f0,0.0f0,0.6f0)
colormap :viridis
colorrange MakieCore.Automatic()
colorscale identity
cycle [:color => :patchcolor]
depth_shift 0.0f0
highclip MakieCore.Automatic()
inspectable true
inspector_clear MakieCore.Automatic()
inspector_hover MakieCore.Automatic()
inspector_label MakieCore.Automatic()
joinstyle :miter
linecap :butt
linestyle "nothing"
lowclip MakieCore.Automatic()
miter_limit 1.0471975511965976
nan_color :transparent
overdraw false
shading MakieCore.NoShading
space :data
ssao false
strokecolor :black
strokecolormap :viridis
strokewidth 0
transparency false
visible true
```

`AlgebraOfGraphics.colorbar!`

— Method`colorbar!(figpos, grid; kwargs...)`

Compute colorbar for `grid`

(which should be the output of `draw!`

) and draw it in position `figpos`

. Attributes allowed in `kwargs`

are the same as `MakieLayout.Colorbar`

.

`AlgebraOfGraphics.compute_attributes`

— Method`compute_attributes(pl::ProcessedLayer, categoricalscales, continuousscales_grid, continuousscales)`

Process attributes of a `ProcessedLayer`

. In particular,

- remove AlgebraOfGraphics-specific layout attributes,
- opt out of Makie cycling mechanism,
- customize behavior of
`color`

(implementing`alpha`

transparency), - customize behavior of bar
`width`

(default to one unit when not specified), - set correct
`colorrange`

.

Return computed attributes.

`AlgebraOfGraphics.datetimeticks`

— Method`datetimeticks(datetimes::AbstractVector{<:TimeType}, labels::AbstractVector{<:AbstractString})`

Generate ticks matching `datetimes`

to the corresponding `labels`

. The result can be passed to `xticks`

, `yticks`

, or `zticks`

.

`AlgebraOfGraphics.datetimeticks`

— Method`datetimeticks(f, datetimes::AbstractVector{<:TimeType})`

Compute ticks for the given `datetimes`

using a formatting function `f`

. The result can be passed to `xticks`

, `yticks`

, or `zticks`

.

`AlgebraOfGraphics.density`

— Method`density(; datalimits=automatic, kernel=automatic, bandwidth=automatic, npoints=200)`

Fit a kernel density estimation of `data`

.

Here, `datalimits`

specifies the range for which the density should be calculated (it defaults to the extrema of the whole data). The keyword argument `datalimits`

can be a tuple of two values, e.g. `datalimits=(0, 10)`

, or a function to be applied group by group, e.g. `datalimits=extrema`

. The keyword arguments `kernel`

and `bandwidth`

are forwarded to `KernelDensity.kde`

. `npoints`

is the number of points used by Makie to draw the line

Weighted data is supported via the keyword `weights`

(passed to `mapping`

).

`AlgebraOfGraphics.draw!`

— Method`draw!(fig, d::AbstractDrawable; axis=NamedTuple(), palettes=NamedTuple())`

Draw a `AlgebraOfGraphics.AbstractDrawable`

object `d`

on `fig`

. In practice, `d`

will often be a `AlgebraOfGraphics.Layer`

or `AlgebraOfGraphics.Layers`

. `fig`

can be a figure, a position in a layout, or an axis if `d`

has no facet specification. The output can be customized by giving axis attributes to `axis`

or custom palettes to `palettes`

.

`AlgebraOfGraphics.draw`

— Method`draw(d; axis=NamedTuple(), figure=NamedTuple, palettes=NamedTuple())`

Draw a `AlgebraOfGraphics.AbstractDrawable`

object `d`

. In practice, `d`

will often be a `AlgebraOfGraphics.Layer`

or `AlgebraOfGraphics.Layers`

. The output can be customized by giving axis attributes to `axis`

, figure attributes to `figure`

, or custom palettes to `palettes`

. Legend and colorbar are drawn automatically. For finer control, use `draw!`

, `legend!`

, and `colorbar!`

independently.

`AlgebraOfGraphics.draw`

— Method`draw(p::PaginatedLayers, i::Int; kws...)`

Draw the ith element of `PaginatedLayers`

`p`

and return a `FigureGrid`

. Keywords `kws`

are passed to the underlying `draw`

call.

You can retrieve the number of elements using `length(p)`

.

`AlgebraOfGraphics.draw`

— Method`draw(p::PaginatedLayers; kws...)`

Draw each element of `PaginatedLayers`

`p`

and return a `Vector{FigureGrid}`

. Keywords `kws`

are passed to the underlying `draw`

calls.

`AlgebraOfGraphics.expectation`

— Method`expectation()`

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

`AlgebraOfGraphics.frequency`

— Method`frequency()`

Compute a frequency table of the arguments.

`AlgebraOfGraphics.histogram`

— Method`histogram(; bins=automatic, datalimits=automatic, closed=:left, normalization=:none)`

Compute a histogram.

The attribute `bins`

can be an `Integer`

, an `AbstractVector`

(in particular, a range), or a `Tuple`

of either integers or abstract vectors (useful for 2- or 3-dimensional histograms). When `bins`

is an `Integer`

, it denotes the approximate number of equal-width intervals used to compute the histogram. In that case, the range covered by the intervals is defined by `datalimits`

(it defaults to the extrema of the whole data). The keyword argument `datalimits`

can be a tuple of two values, e.g. `datalimits=(0, 10)`

, or a function to be applied group by group, e.g. `datalimits=extrema`

. When `bins`

is an `AbstractVector`

, it denotes the intervals directly.

`closed`

determines whether the the intervals are closed to the left or to the right.

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`

(passed to `mapping`

).

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.legend!`

— Method`legend!(figpos, grid; kwargs...)`

Compute legend for `grid`

(which should be the output of `draw!`

) and draw it in position `figpos`

. Attributes allowed in `kwargs`

are the same as `MakieLayout.Legend`

.

`AlgebraOfGraphics.linear`

— Method`linear(; interval=automatic, level=0.95, dropcollinear=false, npoints=200)`

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, for a given coverage `level`

(the default `0.95`

equates `alpha = 0.05`

). Valid values of `interval`

are `:confidence`

, to delimit the uncertainty of the predicted relationship, and `:prediction`

, to delimit estimated bounds for new data points. Use `interval = nothing`

to only compute the line fit, without any uncertainty estimate. By default, this analysis errors on singular (collinear) data. To avoid that, it is possible to set `dropcollinear=true`

. `npoints`

is the number of points used by Makie to draw the shaded band.

Weighted data is supported via the keyword `weights`

(passed to `mapping`

).

`AlgebraOfGraphics.linesfill`

— Method`linesfill(xs, ys; lower, upper, attributes...)`

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 `MakieCore.Plot{AlgebraOfGraphics.linesfill}`

are:

```
color :black
colormap :viridis
colorrange MakieCore.Automatic()
fillalpha 0.15
linestyle "nothing"
linewidth 1.5
lower MakieCore.Automatic()
upper MakieCore.Automatic()
```

`AlgebraOfGraphics.nonnumeric`

— Method`nonnumeric(x)`

Transform `x`

into a non numeric type that is printed and sorted in the same way.

`AlgebraOfGraphics.paginate`

— Method`paginate(l; layout=nothing, row=nothing, col=nothing)`

Paginate `l`

, the `Layer`

or `Layers`

object created by an `AlgebraOfGraphics`

spec, to create a `PaginatedLayers`

object. This contains a vector of layers where each layer operates on a subset of the input data.

The `PaginatedLayers`

object can be passed to `draw`

which will return a `Vector{FigureGrid}`

rather than a single figure.

The keywords that limit the number of subplots on each page are the same that are used to specify facets in `mapping`

:

`layout`

: Maximum number of subplots in a wrapped linear layout.`row`

: Maximum number of rows in a 2D layout.`col`

: Maximum number of columns in a 2D layout.

**Example**

```
d = data((
x = rand(1000),
y = rand(1000),
group1 = rand(string.('a':'i'), 1000),
group2 = rand(string.('j':'r'), 1000),
))
layer_1 = d * mapping(:x, :y, layout = :group1) * visual(Scatter)
paginated_1 = paginate(layer_1, layout = 9)
figuregrids = draw(paginated_1)
layer_2 = d * mapping(:x, :y, row = :group1, col = :group2) * visual(Scatter)
paginated_2 = paginate(layer_2, row = 4, col = 3)
figuregrid = draw(paginated_2, 1) # draw only the first grid
```

`AlgebraOfGraphics.plottypes_attributes`

— Method`plottypes_attributes(entries)`

Return plottypes and relative attributes, as two vectors of the same length, for the given `entries`

.

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

— Method`scientific_eltype(v)`

Determine whether `v`

should be treated as a continuous, geometrical, or categorical array.

`AlgebraOfGraphics.scientific_type`

— Method`scientific_type(T::Type)`

Determine whether `T`

represents a continuous, geometrical, or categorical variable.

`AlgebraOfGraphics.set_aog_theme!`

— Method`set_aog_theme!(; kwargs...)`

Set the current theme to a predefined and opinionated theme, as defined by the unexported internal function `AlgebraOfGraphics.aog_theme`

.

To tweak the predefined theme, use the function `Makie.update_theme!`

. See the example below on how to change, e.g., default fontsize, title, and markersize.

For more information about setting themes, see the `Theming`

section of the `Makie.jl`

docs.

**Examples**

```
julia> using CairoMakie, AlgebraOfGraphics
julia> set_aog_theme!() # Sets a prefedined theme
julia> update_theme!( # Tweaks the current theme
fontsize=30,
markersize=40,
Axis=(title="MyDefaultTitle",)
)
```

`AlgebraOfGraphics.smooth`

— Method`smooth(; span=0.75, degree=2, npoints=200)`

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

is the number of points used by Makie to draw the line

`AlgebraOfGraphics.sorter`

— Method`sorter(ks)`

Utility to reorder a categorical variable, as in `sorter(["low", "medium", "high"])`

. A vararg method `sorter("low", "medium", "high")`

is also supported. `ks`

should include all the unique values of the categorical variable. The order of `ks`

is respected in the legend.

`AlgebraOfGraphics.verbatim`

— Method`verbatim(x)`

Signal that `x`

should not be rescaled, but used in the plot as is.