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

**URL:** <https://discourse.julialang.org/t/aog-error-no-aesthetic-mapping-defined/117398>\
**Category:** General Usage\
**Tags:** question, makie, algebraofgraphics\
**Created:** [July 23, 2024, 8:56pm UTC](https://discourse.julialang.org/t/aog-error-no-aesthetic-mapping-defined/117398 "2024-07-23T20:56:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hendri54](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hendri54/32/9621_2.png) [@hendri54](https://discourse.julialang.org/u/hendri54)\
**Post date:** [July 23, 2024, 8:56pm UTC](https://discourse.julialang.org/t/aog-error-no-aesthetic-mapping-defined/117398/1 "2024-07-23T20:56:26Z")

</div>

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.

```julia
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
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

```

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [July 23, 2024, 9:16pm UTC](https://discourse.julialang.org/t/aog-error-no-aesthetic-mapping-defined/117398/2 "2024-07-23T21:16:55Z")

</div>

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](https://github.com/MakieOrg/AlgebraOfGraphics.jl/blob/master/src/aesthetics.jl)

---

<div class="post-metadata">

**Author:** ![hendri54](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hendri54/32/9621_2.png) [@hendri54](https://discourse.julialang.org/u/hendri54)\
**Post date:** [July 23, 2024, 9:39pm UTC](https://discourse.julialang.org/t/aog-error-no-aesthetic-mapping-defined/117398/3 "2024-07-23T21:39:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [July 24, 2024, 3:58am UTC](https://discourse.julialang.org/t/aog-error-no-aesthetic-mapping-defined/117398/4 "2024-07-24T03:58:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hendri54](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hendri54/32/9621_2.png) [@hendri54](https://discourse.julialang.org/u/hendri54)\
**Post date:** [July 24, 2024, 11:37am UTC](https://discourse.julialang.org/t/aog-error-no-aesthetic-mapping-defined/117398/5 "2024-07-24T11:37:35Z")

</div>

Will do - thank you.
