7 Data Visualization with AlgebraOfGraphics.jl

AlgebraOfGraphics.jl is a higher-level plotting package that uses Makie.jl under the hood. It is geared towards data visualization workflows with support for DataFrames. AlgebraOfGraphics.jl abstracts away some common patterns in data visualization using an interface similar to R’s ggplot2 package.

AlgebraOfGraphics.jl follows a layered approach to construct visualizations in a structured manner. There are four main types of layers:

  • data layer
  • mapping layer
  • visual transformation layer
  • statistical transformation layer

NOTE: AlgebraOfGraphics.jl has some guiding principles described in their philosophy section.

AlgebraOfGraphics.jl allows you to construct all of these types of layers with functions that return a Layer object, in which all of the information necessary will be encoded. You can then perform two operations on layers:

  • multiplication with *: this fuses two or more layers into a single layer
  • addition with +: this superimposes two or more layers into a vector of Layers

Finally, as the name suggests, AlgebraOfGraphics.jl is an algebra for Layer objects. And, as such, it defines two algebraic properties. Let a, b and c be Layer objects, then the following two properties hold:

  • associative property: (a * b) * c = a * (b * c)
  • distributive property: a * (b + c) = (a * b) + (a + b)

To get started with AlgebraOfGraphics.jl, you’ll need to load it along with a desired Makie.jl backend (Chapter 6):

  1. using AlgebraOfGraphics
  2. using CairoMakie

7 Data Visualization with Al.. - 图1 Support this project
CC BY-NC-SA 4.0 Jose Storopoli, Rik Huijzer, Lazaro Alonso