# X and y axis equal scaling

**URL:** <https://discourse.julialang.org/t/x-and-y-axis-equal-scaling/30366>\
**Category:** Visualization\
**Tags:** plots\
**Created:** [October 27, 2019, 1:49pm UTC](https://discourse.julialang.org/t/x-and-y-axis-equal-scaling/30366 "2019-10-27T13:49:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![squirrel](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@squirrel](https://discourse.julialang.org/u/squirrel)\
**Post date:** [October 27, 2019, 1:49pm UTC](https://discourse.julialang.org/t/x-and-y-axis-equal-scaling/30366/1 "2019-10-27T13:49:13Z")

</div>

How do I make the x and y axis have equal scaling?  
If can cheat it with `size = (800,800)`, for example, but then if I add labels or a title, or change the axis limits, this requires a lot of adjusting. Is there any way I can make it automatic?

```julia
using Plots

x(u) = u
y(u) = sqrt(u)
y2(u) = -sqrt(u)
plot(x, [y, y2], 0, 5,
    framestyle = :origin,
    legend = :none,
    linecolor = :blue,
    xlim = [-6, 6],
    ylim = [-6, 6],
    ticks = -6:1:6,
    xlabel = "y"
)

```

---

<div class="post-metadata">

**Author:** ![jkbest2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jkbest2/32/7350_2.png) [@jkbest2](https://discourse.julialang.org/u/jkbest2)\
**Post date:** [October 27, 2019, 2:21pm UTC](https://discourse.julialang.org/t/x-and-y-axis-equal-scaling/30366/2 "2019-10-27T14:21:21Z")

</div>

Use the keyword argument `aspect_ratio = 1`.

---

<div class="post-metadata">

**Author:** ![bert](https://avatars.discourse-cdn.com/v4/letter/b/9e8a1a/32.png) [@bert](https://discourse.julialang.org/u/bert)\
**Post date:** [August 11, 2022, 7:40pm UTC](https://discourse.julialang.org/t/x-and-y-axis-equal-scaling/30366/3 "2022-08-11T19:40:08Z")

</div>

Can also use `aspect_ratio=:equal` to indicate that 1 unit on the x-axis should equal 1 unit on the y-axis, regardless of the axis bounds.
