# Scale z plot3d

**URL:** <https://discourse.julialang.org/t/scale-z-plot3d/58953>\
**Category:** Visualization\
**Tags:** plotting\
**Created:** [April 9, 2021, 11:16pm UTC](https://discourse.julialang.org/t/scale-z-plot3d/58953 "2021-04-09T23:16:56Z")\
**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:** [April 9, 2021, 11:16pm UTC](https://discourse.julialang.org/t/scale-z-plot3d/58953/1 "2021-04-09T23:16:56Z")

</div>

Dear all,  
How can I reduze the zscale in my plot?

```julia
using Plots
plotly()

f(x,y) = y < x ? cos(8x) + sin(8y) : NaN
x = LinRange(-2, 2, 100);
y = LinRange(-2, 2, 100);
surface(x, y, f,aspect_ratio = .3)

```

See the strange figure. Aspect ration reduces all dimensions…

![image](https://global.discourse-cdn.com/julialang/original/3X/d/f/df7dad19f3cd1366090ef2f9dac48c8cd82a709d.png)

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [April 10, 2021, 6:38pm UTC](https://discourse.julialang.org/t/scale-z-plot3d/58953/2 "2021-04-10T18:38:28Z")

</div>

Try playing with the `zlims` argument, for ex.: `surface(x, y, f, zlims=(-4,4))`

---

<div class="post-metadata">

**Author:** ![empet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/empet/32/221303_2.png) [@empet](https://discourse.julialang.org/u/empet)\
**Post date:** [April 11, 2021, 4:35pm UTC](https://discourse.julialang.org/t/scale-z-plot3d/58953/3 "2021-04-11T16:35:35Z")

</div>

@angeloaliano1  
To customize both aspect ratio and plot aesthetics you can use PlotlyJS.jl:

```julia
using PlotlyJS
include("plotlyju.jl"); # style file: https://gist.github.com/empet/6b4f441ed96d724d67ff77f1fb8b0a79

f(x,y) = y < x ? cos(8x) + sin(8y) : NaN
xg = -2:0.02:2
z = [f.(x,y) for x in xg, y in xg];

trace = PlotlyJS.surface(x=xg, y =xg, z=z, 
                         colorbar_len=0.7)
pl = PlotlyJS.plot(trace, 
                   Layout(width=600, height=600,
                         scene_aspectratio=attr(x=1, y=1, z=0.5)), 
                   style=plotlyju)

```

 ![plot3d](https://global.discourse-cdn.com/julialang/original/3X/5/8/58b380c5aad59c0c5400d3f83ccdf91977cc8c94.jpeg)
