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 passing named tuples or dictionaries with settings via the axis or facet keywords.
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.
Compute legend for grid (which should be the output of draw!) and draw it in position figpos. All kwargs are forwarded to Makie's Legend constructor.
The order of scales represented in the legend can be changed with the order keyword. By default, legend sections are ordered the same as they appear in the plot specification. Assuming three scales Color, MarkerSize and custom exist in a spec, you can pass a vector to reorder them like [:MarkerSize, :custom, :Color], or merge multiple entries together with a nested vector like [[:MarkerSize, :custom], :Color], or give merged sections a title with the pair syntax [[:MarkerSize, :custom] => "Merged group", :Color].
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.
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 passing named tuples or dictionaries with settings via the axis or facet keywords.
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.
Compute legend for grid (which should be the output of draw!) and draw it in position figpos. All kwargs are forwarded to Makie's Legend constructor.
The order of scales represented in the legend can be changed with the order keyword. By default, legend sections are ordered the same as they appear in the plot specification. Assuming three scales Color, MarkerSize and custom exist in a spec, you can pass a vector to reorder them like [:MarkerSize, :custom, :Color], or merge multiple entries together with a nested vector like [[:MarkerSize, :custom], :Color], or give merged sections a title with the pair syntax [[:MarkerSize, :custom] => "Merged group", :Color].
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),
@@ -28,7 +28,7 @@
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
Create a Scales object containing properties for aesthetic scales that can be passed to draw and draw!. Each keyword should be the name of a scale in the spec that is being drawn. That can either be a default one like Color, Marker or LineStyle, or a custom scale name defined in a mapping using the scale function.
The values attached to the keywords must be dict-like, with Symbols as keys (such as NamedTuples).
Return DirectData(x) which marks x for direct use in a mapping that's used with a table-like data source. As a result, x will be used directly as data, without lookup in the table. If x is not an AbstractArray, it will be expanded like fill(x, n) where n is the number of rows in the data source.
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"])
+figuregrid = draw(paginated_2, 1) # draw only the first grid
Create a Scales object containing properties for aesthetic scales that can be passed to draw and draw!. Each keyword should be the name of a scale in the spec that is being drawn. That can either be a default one like Color, Marker or LineStyle, or a custom scale name defined in a mapping using the scale function.
The values attached to the keywords must be dict-like, with Symbols as keys (such as NamedTuples).
Return DirectData(x) which marks x for direct use in a mapping that's used with a table-like data source. As a result, x will be used directly as data, without lookup in the table. If x is not an AbstractArray, it will be expanded like fill(x, n) where n is the number of rows in the data source.
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.
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.
Create a ScaleID object that can be used in a mapping to assign a custom id to the mapped variable. This variable will then not be merged into the default scale for its aesthetic type, but instead be handled separately, leading to a separate legend entry.
Use within a pair expression in mapping to signal that a categorical column from the data source should be used in the original order and not automatically sorted.
Example:
# normally, categories would be sorted a, b, c but with `presorted`
+Class Two
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.
Create a ScaleID object that can be used in a mapping to assign a custom id to the mapped variable. This variable will then not be merged into the default scale for its aesthetic type, but instead be handled separately, leading to a separate legend entry.
Use within a pair expression in mapping to signal that a categorical column from the data source should be used in the original order and not automatically sorted.
Example:
# normally, categories would be sorted a, b, c but with `presorted`
# they stay in the order b, c, a
-data((; some_column = ["b", "c", "a"])) * mapping(:some_column => presorted)
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.
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
@@ -51,4 +51,4 @@
fontsize=30,
markersize=40,
Axis=(title="MyDefaultTitle",)
- )
Mark a colormap as continuous such that AlgebraOfGraphics will sample a categorical palette from start to end in n steps, and not by using the first n colors.
You could also use cgrad(colormap, n; categorical = true), however, this requires you to specify how many levels there are, which from_continuous detects automatically.