AoG error: "No aesthetic mapping defined ..."

I defined a wrapper function around AoG’s visual(BarPlot) with a fair number of options (subplots, sub-figures, etc). This worked fine until I updated to AoG v0.7.2 and CairoMakie v 0.12.5
Now calling the function yields the error shown below.

The input data is a DataFrame with a mixture of categorical and Float64 columns.

Before I disable plot options one by one to figure out where the error comes from, I thought I should ask if anyone happens to have a solid idea what might be going on.

ERROR: No aesthetic mapping defined yet for plot type Plot{Makie.crossbar} with scientific eltypes (AlgebraOfGraphics.Categorical(), AlgebraOfGraphics.Continuous(), AlgebraOfGraphics.Continuous(), AlgebraOfGraphics.Continuous()). AlgebraOfGraphics can only use plot types if it is told which attributes and input arguments map to which aesthetics like color, markersize or linewidth for example.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] aesthetic_mapping(::Type{Plot{…}}, ::AlgebraOfGraphics.Categorical, ::AlgebraOfGraphics.Continuous, ::AlgebraOfGraphics.Continuous, ::AlgebraOfGraphics.Continuous)
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/gJmTR/src/aesthetics.jl:50
  [3] aesthetic_mapping(plottype::Type, attributes::Dictionaries.Dictionary{Symbol, Any}, scitypes::Vector{AlgebraOfGraphics.ScientificType})
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/gJmTR/src/aesthetics.jl:31
  [4] aesthetic_mapping
    @ ~/.julia/packages/AlgebraOfGraphics/gJmTR/src/aesthetics.jl:28 [inlined]
  [5] compute_scale_properties(processedlayers::Vector{ProcessedLayer}, scales::AlgebraOfGraphics.Scales)
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/gJmTR/src/algebra/layers.jl:140
  [6] compute_axes_grid(d::Layers, scales::AlgebraOfGraphics.Scales; axis::Dictionaries.Dictionary{Symbol, Any})
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/gJmTR/src/algebra/layers.jl:237
  [7] compute_axes_grid
    @ ~/.julia/packages/AlgebraOfGraphics/gJmTR/src/algebra/layers.jl:233 [inlined]
  [8] compute_axes_grid(fig::Figure, d::Layers, scales::AlgebraOfGraphics.Scales; axis::Dictionaries.Dictionary{Symbol, Any})
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/gJmTR/src/algebra/layers.jl:205
  [9] compute_axes_grid
    @ ~/.julia/packages/AlgebraOfGraphics/gJmTR/src/algebra/layers.jl:202 [inlined]
 [10] #338
    @ ~/.julia/packages/AlgebraOfGraphics/gJmTR/src/draw.jl:20 [inlined]
 [11] update
    @ ~/.julia/packages/AlgebraOfGraphics/gJmTR/src/draw.jl:10 [inlined]
 [12] plot!(fig::Figure, d::Layers, scales::AlgebraOfGraphics.Scales; axis::Dictionaries.Dictionary{Symbol, Any})
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/gJmTR/src/draw.jl:20
 [13] plot!
    @ ~/.julia/packages/AlgebraOfGraphics/gJmTR/src/draw.jl:16 [inlined]
 [14] (::AlgebraOfGraphics.var"#343#344"{…})(f::Figure)
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/gJmTR/src/draw.jl:64
 [15] update
    @ ~/.julia/packages/AlgebraOfGraphics/gJmTR/src/draw.jl:10 [inlined]
 [16] _draw(d::Layers, scales::AlgebraOfGraphics.Scales; axis::Dictionaries.Dictionary{…}, figure::Dictionaries.Dictionary{…}, facet::Dictionaries.Dictionary{…}, legend::Dictionaries.Dictionary{…}, colorbar::Dictionaries.Dictionary{…})
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/gJmTR/src/draw.jl:63
 [17] _draw
    @ ~/.julia/packages/AlgebraOfGraphics/gJmTR/src/draw.jl:60 [inlined]
 [18] draw(d::Layers, scales::AlgebraOfGraphics.Scales; axis::@NamedTuple{…}, figure::@NamedTuple{}, facet::@NamedTuple{…}, legend::@NamedTuple{…}, colorbar::@NamedTuple{}, palette::Nothing)
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/gJmTR/src/draw.jl:57
 [19] draw
    @ ~/.julia/packages/AlgebraOfGraphics/gJmTR/src/draw.jl:47 [inlined]
 [20] bar_aog_one(plt::Layers; hasSubPlots::Bool, titleStr::Nothing, axisOpts::Dict{Symbol, Any}, facet::Dict{Symbol, Any}, legendOpts::Dict{Symbol, Any})
    @ MismatchMM ~/Documents/projects/p2022/mismatch/MismatchMM/FiguresMM/src/bar_graphs.jl:138
julia> versioninfo()
Julia Version 1.10.4
Commit 48d4fd48430 (2024-06-04 10:41 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 8 × Apple M1 Pro
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 8 default, 0 interactive, 4 GC (on 6 virtual cores)
Environment:
  JULIA_NUM_THREADS = 8
  JULIA_PKG_DEVDIR = /Users/lutz/Documents/julia
  JULIA_EDITOR = /usr/local/bin/code

In 0.7 every plotting function needs an aesthetic mapping to tell AoG what the different positional or named arguments refer to. You seem to be using Crossbar but this is not yet implemented because it’s one of the less used ones. This is the file with the existing mappings AlgebraOfGraphics.jl/src/aesthetics.jl at master · MakieOrg/AlgebraOfGraphics.jl · GitHub

Thank you. I thought I was using visual(BarPlot) everywhere, but it turns out that you are right - there is a branch that uses crossbar for standard error bars.

I will have to figure out whether I can define an aesthetic for it.

We can look into adding it to AoG again, you could open an issue to track it

1 Like

Will do - thank you.