# Understanding aspect ratio along-with xlim,ylim in Plot.jl

**URL:** <https://discourse.julialang.org/t/understanding-aspect-ratio-along-with-xlim-ylim-in-plot-jl/93120>\
**Category:** New to Julia\
**Tags:** plotting\
**Created:** [January 17, 2023, 10:46pm UTC](https://discourse.julialang.org/t/understanding-aspect-ratio-along-with-xlim-ylim-in-plot-jl/93120 "2023-01-17T22:46:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sarthak](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@sarthak](https://discourse.julialang.org/u/sarthak)\
**Post date:** [January 17, 2023, 10:46pm UTC](https://discourse.julialang.org/t/understanding-aspect-ratio-along-with-xlim-ylim-in-plot-jl/93120/1 "2023-01-17T22:46:42Z")

</div>

```julia
g(x) = x^4
fig1 = plot(g, xlim=(-20,20),ylim=(-20,20),aspect_ratio=:equal)
fig2 = plot(g, -20,20)#aspect_ratio=:equal
fig3 = plot(fig1, fig2, layout = (1, 2), legend = false)

```

![fig-2](https://global.discourse-cdn.com/julialang/original/3X/6/a/6a868342e2a309e0a55cc3989bf53043fa27631f.png)

Question: How to ensure equal aspect ratio in right figure? Figure on the left is not useful due to non smoothness plot.

Kind regards

---

<div class="post-metadata">

**Author:** ![Dan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dan/32/42581_2.png) [@Dan](https://discourse.julialang.org/u/Dan)\
**Post date:** [January 18, 2023, 2:16am UTC](https://discourse.julialang.org/t/understanding-aspect-ratio-along-with-xlim-ylim-in-plot-jl/93120/2 "2023-01-18T02:16:23Z")

</div>

The non-smoothness is due to the automatic choice of evaluation points by the `plot` function. If the function is given a more explicit x-axis range, it fixes this issue. So, the following might fix the problem:

```julia
fig1 = plot(g, -3,3; xlim=(-20,20),ylim=(-20,20),aspect_ratio=:equal)

```
