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:

  1. blue = visual(Scatter; color=:steelblue, marker=:cross)
  2. red = linear() * visual(; color=:red, linestyle=:dot, linewidth=5)
  3. plt = data(synthetic_df) * mapping(:x, :y) * (blue + red)
  4. draw(plt)

Figure 62: AlgebraOfGraphics customized scatter plot with linear trend estimation.

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: a Symbol for a light blue color, :steelblue
  • marker: a Symbol 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: a Symbol for the red color, :red
  • linestyle: a Symbol 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.

7.4 Plot Customizations - 图2 Support this project
CC BY-NC-SA 4.0 Jose Storopoli, Rik Huijzer, Lazaro Alonso