# How can I rotate the BoxPlot with AoG?

**URL:** <https://discourse.julialang.org/t/how-can-i-rotate-the-boxplot-with-aog/102218>\
**Category:** Visualization\
**Tags:** plotting, makie, algebraofgraphics, cairomakie\
**Created:** [July 28, 2023, 11:12pm UTC](https://discourse.julialang.org/t/how-can-i-rotate-the-boxplot-with-aog/102218 "2023-07-28T23:12:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![AugustoCL](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/augustocl/32/32022_2.png) [@AugustoCL](https://discourse.julialang.org/u/AugustoCL)\
**Post date:** [July 28, 2023, 11:12pm UTC](https://discourse.julialang.org/t/how-can-i-rotate-the-boxplot-with-aog/102218/1 "2023-07-28T23:12:54Z")

</div>

I’m trying to reproduce the following plot using AoG customizing whatever is needed with CairoMakie properties/parameters. So, as the names are long, I need to rotate them to see better.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/8/7/870c27b566e1796d6e249087635e1c1df6ffe0c4.png)

this plot just used `coord_flip()` from ggplot2 to accomplish the objective

I find the `orientation=:horizontal` boxplot parameter, that works with the visual step, but all the axis got broken, the numbers of axis dissapeared, as you can see below.  
nd after looking for parameters of Axis in Makie API documentation, I couldn’t realize how I can solute this.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/2/2/22b7166d4a0add0a0bb81088a5aca74ff1eddeb3.png)

code of the plot above

```julia
plt = data(df) *
  visual(BoxPlot, show_notch=true, orientation=:horizontal) *
  mapping(:major_category, :median);
draw(plt)

```

I appreciate any help with this, tks.

---

<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 29, 2023, 12:46am UTC](https://discourse.julialang.org/t/how-can-i-rotate-the-boxplot-with-aog/102218/2 "2023-07-29T00:46:21Z")

</div>

I don’t think AoG can do this right now, unfortunately. That’s because it assumes that the first argument is x, the second y, even though the barplot attribute switches that around.

---

<div class="post-metadata">

**Author:** ![AugustoCL](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/augustocl/32/32022_2.png) [@AugustoCL](https://discourse.julialang.org/u/AugustoCL)\
**Post date:** [July 29, 2023, 2:38am UTC](https://discourse.julialang.org/t/how-can-i-rotate-the-boxplot-with-aog/102218/4 "2023-07-29T02:38:01Z")

</div>

I see.  
Thanks for the answer.

This case looks good to create an issue, do you know if it already exists or can I go ahead and create one?

---

<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 29, 2023, 9:36am UTC](https://discourse.julialang.org/t/how-can-i-rotate-the-boxplot-with-aog/102218/5 "2023-07-29T09:36:35Z")

</div>

I’m not a hundred percent sure but there’s probably an issue by me about this 😄

---

<div class="post-metadata">

**Author:** ![AugustoCL](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/augustocl/32/32022_2.png) [@AugustoCL](https://discourse.julialang.org/u/AugustoCL)\
**Post date:** [August 8, 2023, 3:37am UTC](https://discourse.julialang.org/t/how-can-i-rotate-the-boxplot-with-aog/102218/6 "2023-08-08T03:37:16Z")

</div>

Did you know if I can do this using CairoMakie?

any instruction will help. tks

---

<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:** [August 8, 2023, 4:24am UTC](https://discourse.julialang.org/t/how-can-i-rotate-the-boxplot-with-aog/102218/7 "2023-08-08T04:24:41Z")

</div>

```julia
julia> categories = repeat(1:3, inner = 100); data = randn(300) .* categories;

julia> boxplot(
           categories,
           data,
           orientation = :horizontal,
           color = :white,
           strokecolor = :black,
           strokewidth = 1.5,
           outliercolor = :black,
           axis = (; yticks = (1:3, ["A", "B", "C"]))
       )

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/a/8/a83c5df0d7532f377ce6c64659ac9494a3dfc232.png)
