# Xticks spacing changes when decorations are hidden

**URL:** <https://discourse.julialang.org/t/xticks-spacing-changes-when-decorations-are-hidden/71937>\
**Category:** Visualization\
**Tags:** makie\
**Created:** [November 23, 2021, 10:55am UTC](https://discourse.julialang.org/t/xticks-spacing-changes-when-decorations-are-hidden/71937 "2021-11-23T10:55:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![HenriDeh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrideh/32/8316_2.png) [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Post date:** [November 23, 2021, 10:55am UTC](https://discourse.julialang.org/t/xticks-spacing-changes-when-decorations-are-hidden/71937/1 "2021-11-23T10:55:09Z")

</div>

Helloo,

I made a MWE that emulates the kind of problem I have:

```julia
begin
       f = Figure()
       gl = GridLayout()
       f.layout[1,1] = gl
       for i in 1:2, j in 1:2
       gl[i,j] = a = Axis(f)
       for (i,data) in enumerate([rand(100) for i in 1:(j == 2 ? 3 : 5)])
           boxplot!(a, fill(i,100), data)
           end
       if j == 2
          hideydecorations!(a, grid = false)
          end
          end
       colsize!(gl, 1, Relative(5/8))
       Label(f[1,0], "A common y label", rotation = pi/2, tellheight = false)
       Label(f[2,1:2], "A common x label", tellwidth = false)
       f
       end

```

To obtain

 ![image](https://global.discourse-cdn.com/julialang/original/3X/0/1/01c44c60b83b07b1b1f31ce006f2c147be53d7ae.png)

I know it may sound as a silly detail, but because I hide the y-decorations of the second column in the GL, the spacing between the xticks is not the same (if you use a ruler).  
I’d like to know if there’s a way to set the relative colsize wrt the content of the axes only?

EDIT: Actually, the x-spines of the axes are correctly 5/8-3/8. The problem is more that the width of the boxes are not the same and thus the space between ticks neither.

Many thanks

---

<div class="post-metadata">

**Author:** ![HenriDeh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrideh/32/8316_2.png) [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Post date:** [November 23, 2021, 12:43pm UTC](https://discourse.julialang.org/t/xticks-spacing-changes-when-decorations-are-hidden/71937/2 "2021-11-23T12:43:30Z")

</div>

Okay I found on my own. The difference between upper and lower xlims are not integers when auto-determined. Setting to 0.5 and 5+0.5 or 3+0.5 ensures they add to 8.

Here’s a working solution if someone’s ever interested:

```julia
begin
       f = Figure()
       gl = GridLayout()
       f.layout[1,1] = gl
       for i in 1:2, j in 1:2
            gl[i,j] = a = Axis(f)
            n = (j == 2 ? 3 : 5)
            for (i,data) in enumerate([rand(100) for i in 1:n])
                boxplot!(a, fill(i,100), data)
            end
            if j == 2
                hideydecorations!(a, grid = false)
            end
            xlims!(a, low = 0.5, high = n+0.5)
            a.xticks = 1:n
        end
       colsize!(gl, 1, Relative(5/8))
       colsize!(gl, 2, Relative(3/8))
       Label(f[1,0], "A common y label", rotation = pi/2, tellheight = false)
       Label(f[2,1:2], "A common x label", tellwidth = false)
       f
end

```

---

<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:** [November 23, 2021, 2:57pm UTC](https://discourse.julialang.org/t/xticks-spacing-changes-when-decorations-are-hidden/71937/3 "2021-11-23T14:57:50Z")

</div>

The reason is that the automatic gaps are given in fractions of the data limits, and 10% of the left plot x range is more than 10% of the right.
