# AlgebraOfGraphics: how to add xlabel and ylabel

**URL:** <https://discourse.julialang.org/t/algebraofgraphics-how-to-add-xlabel-and-ylabel/56408>\
**Category:** Visualization\
**Tags:** makie, algebraofgraphics\
**Created:** [March 3, 2021, 2:02pm UTC](https://discourse.julialang.org/t/algebraofgraphics-how-to-add-xlabel-and-ylabel/56408 "2021-03-03T14:02:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![phlavenk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/phlavenk/32/1873_2.png) [@phlavenk](https://discourse.julialang.org/u/phlavenk)\
**Post date:** [March 3, 2021, 2:02pm UTC](https://discourse.julialang.org/t/algebraofgraphics-how-to-add-xlabel-and-ylabel/56408/1 "2021-03-03T14:02:06Z")

</div>

I couldn’t find an example of how to add an x-axis label to the algebra flow.  
For example, in this simple plot, how would I add a “Number of cylinders” x label to both subfigures?

```julia
using RDatasets: dataset
using AlgebraOfGraphics, CairoMakie
mpg = dataset("ggplot2", "mpg");
mpg.IsAudi = mpg.Manufacturer .== "audi"
geom = visual(BoxPlot, layout_x = 1) + visual(Violin, layout_x = 2)
data(mpg) *
    mapping(:Cyl => categorical, :Hwy) *
    mapping(dodge = :IsAudi => categorical, color = :IsAudi => categorical) *
    geom |> draw

```

---

<div class="post-metadata">

**Author:** ![fabgrei](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fabgrei/32/4214_2.png) [@fabgrei](https://discourse.julialang.org/u/fabgrei)\
**Post date:** [March 8, 2021, 11:59am UTC](https://discourse.julialang.org/t/algebraofgraphics-how-to-add-xlabel-and-ylabel/56408/2 "2021-03-08T11:59:33Z")

</div>

I don’t think this is easily possible. Depending on what you need, you can try [GitHub - greimel/TabularMakie.jl: Makie plots with legends and labels and everything](https://github.com/greimel/TabularMakie.jl) where you can rename variables on the fly.

(Dodged violin plots will probably not work though)

---

<div class="post-metadata">

**Author:** ![piever](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/piever/32/1815_2.png) [@piever](https://discourse.julialang.org/u/piever)\
**Post date:** [March 8, 2021, 12:29pm UTC](https://discourse.julialang.org/t/algebraofgraphics-how-to-add-xlabel-and-ylabel/56408/3 "2021-03-08T12:29:52Z")

</div>

Yes, “plotting from tables” in the Makie ecosystem is still being worked on. I think you are hitting a bug (I’ve filed [missing x label for horizontally concatenated plots · Issue #147 · JuliaPlots/AlgebraOfGraphics.jl](https://github.com/JuliaPlots/AlgebraOfGraphics.jl/issues/147)).

If you only do one plot, eg `geom = visual(BoxPlot)`, you should get `Cyl` as x axis. It can be renamed by renaming the dataframe column. [greimel/TabularMakie.jl](https://github.com/greimel/TabularMakie.jl) lets you do this on the fly. I still have to get around to an AlgebraOfGraphics revamp, trying to include the work done in TabularMakie.
