7.4 Plot Customizations
Apart from mappings inside a mapping
layer, you can customize AlgebraOfGraphics
visualizations inside the visual
transformation layers.
For example the linear
statistical transformation plot from Section 7.3 can be customized both with the marker objects in the scatter plot but also with the line object in the linear trend plot. We can customize anything that the Makie.jl
’s plotting types support inside visual
:
blue = visual(Scatter; color=:steelblue, marker=:cross)
red = linear() * visual(; color=:red, linestyle=:dot, linewidth=5)
plt = data(synthetic_df) * mapping(:x, :y) * (blue + red)
draw(plt)
Figure 62: AlgebraOfGraphics customized scatter plot with linear trend estimation.
As you can see we are adding the following keyword arguments to visual(Scatter)
transformation layer:
color
: aSymbol
for a light blue color,:steelblue
marker
: aSymbol
for a vertical cross marker type,:cross
Inside the linear
statistical transformation we are adding a new layer to be fused into it with the *
operation, that does not have a positional argument for plotting type since linear
already provides a default plotting type, and has the following keyword arguments:
color
: aSymbol
for the red color,:red
linestyle
: aSymbol
for a dotted line style,:dot
linewidth
: a number representing the width of our line
You can use as many customizations as you want in your plot.
Support this project
CC BY-NC-SA 4.0 Jose Storopoli, Rik Huijzer, Lazaro Alonso