# How to scale the axes in Makie subplots?

**URL:** <https://discourse.julialang.org/t/how-to-scale-the-axes-in-makie-subplots/85881>\
**Category:** Visualization\
**Tags:** question, makie, plot\
**Created:** [August 17, 2022, 4:57pm UTC](https://discourse.julialang.org/t/how-to-scale-the-axes-in-makie-subplots/85881 "2022-08-17T16:57:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![math\_opt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/math_opt/32/25317_2.png) [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Post date:** [August 17, 2022, 4:57pm UTC](https://discourse.julialang.org/t/how-to-scale-the-axes-in-makie-subplots/85881/1 "2022-08-17T16:57:53Z")

</div>

When I create subplots, the y-axis is usually taller than the x-axis. I want them to be of same (or at least similar) length. For example, the following code produces:

```julia
using CairoMakie

function plot()
    f= Figure()

    Axis(f[1, 1])
    barplot!(1:1:5, rand(5))

    Axis(f[1,2])
    barplot!(1:1:10, (rand(10)))

    return f
end

```

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

I would like the scale of both axes to be the same. How do I go about this? Thanks for the help.

---

<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 17, 2022, 5:36pm UTC](https://discourse.julialang.org/t/how-to-scale-the-axes-in-makie-subplots/85881/2 "2022-08-17T17:36:03Z")

</div>

That’s because the default figure size is 800x600, so halving that is going to produce something around 400x600 which is rather tall.

You can either let the figure size determine the plot sizes and do `Figure(resolution = (800, 400))` or something to that effect.

Or you can predetermine the axis sizes, and then adjust the figure size to fit using `resize_to_layout!()` as described on the bottom of this page [Aspect ratio and size control tutorial](https://makie.juliaplots.org/stable/tutorials/aspect-tutorial/index.html)

---

<div class="post-metadata">

**Author:** ![math\_opt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/math_opt/32/25317_2.png) [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Post date:** [August 17, 2022, 5:51pm UTC](https://discourse.julialang.org/t/how-to-scale-the-axes-in-makie-subplots/85881/3 "2022-08-17T17:51:56Z")

</div>

Amazing! Thanks for the quick solution. 🙂
