# Problems with the scale 3d on animations

**URL:** <https://discourse.julialang.org/t/problems-with-the-scale-3d-on-animations/56949>\
**Category:** New to Julia\
**Tags:** plots, animations\
**Created:** [March 11, 2021, 1:41pm UTC](https://discourse.julialang.org/t/problems-with-the-scale-3d-on-animations/56949 "2021-03-11T13:41:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![angeloaliano1](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Post date:** [March 11, 2021, 1:41pm UTC](https://discourse.julialang.org/t/problems-with-the-scale-3d-on-animations/56949/1 "2021-03-11T13:41:31Z")

</div>

Dear all,  
I have the following code to perform an animation in 3d:

```julia
using Plots 
plotlyjs()

anim = Animation()
for n in range(0,2π,length=10)
    t=0:0.1:n
    x=cos.(t)
    y=sin.(t)
    z=t
    scatter(x,y,z,lw=1,markersize = 0.5,color=:blue,xlabel="x",ylabel="y",zlabel="z",legend=false,size=(400,400),
            ratio=1)
    zlims!(0,7)
    xlims!(-2,2)
    ylims!(-2,2)
    frame(anim)
end
gif(anim,"TesteGif2.gif",fps=5)

```

whose output is the following:  
 ![TesteGif2](https://global.discourse-cdn.com/julialang/original/3X/1/b/1b8819dbfd6001e861607e9d4b23bac4787ec32a.gif)  
However, I would to keep the axes of the same length, without increasing or decreasing the scale, throughout the animation. How can I do this?

---

<div class="post-metadata">

**Author:** ![jonniedie](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jonniedie/32/12842_2.png) [@jonniedie](https://discourse.julialang.org/u/jonniedie)\
**Post date:** [March 11, 2021, 4:21pm UTC](https://discourse.julialang.org/t/problems-with-the-scale-3d-on-animations/56949/2 "2021-03-11T16:21:08Z")

</div>

It doesn’t seem to work with the PlotlyJS backend (at least I couldn’t get it working). And it’s unsupported for 3D axes with the PyPlot backend. But if you use the GR backend, you can do it with the keyword argument `aspect_ratio=:equal` instead of `ratio=1`.

---

<div class="post-metadata">

**Author:** ![jonniedie](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jonniedie/32/12842_2.png) [@jonniedie](https://discourse.julialang.org/u/jonniedie)\
**Post date:** [March 11, 2021, 4:24pm UTC](https://discourse.julialang.org/t/problems-with-the-scale-3d-on-animations/56949/3 "2021-03-11T16:24:58Z")

</div>

```julia
using Plots 
gr()

anim = Animation()
for n in range(0,2π,length=10)
    t=0:0.1:n
    x=cos.(t)
    y=sin.(t)
    z=t
    scatter(x,y,z,lw=1,markersize = 2,color=:blue,xlabel="x",ylabel="y",zlabel="z",legend=false,size=(400,400),
            aspect_ratio=:equal)
    zlims!(0,7)
    xlims!(-2,2)
    ylims!(-2,2)
    frame(anim)
end
gif(anim,"TesteGif2.gif",fps=5)

```

![TesteGif2](https://global.discourse-cdn.com/julialang/original/3X/3/4/341397715cbdf138dda3f9f791e3a40c66cff14e.gif)  
I had to make the marker size 2 to make it easier to see, though.
