# Problem plotting surfaces

**URL:** <https://discourse.julialang.org/t/problem-plotting-surfaces/58065>\
**Category:** General Usage\
**Tags:** plotting, plotlyjs\
**Created:** [March 27, 2021, 2:00am UTC](https://discourse.julialang.org/t/problem-plotting-surfaces/58065 "2021-03-27T02:00:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![leopdsf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leopdsf/32/31008_2.png) [@leopdsf](https://discourse.julialang.org/u/leopdsf)\
**Post date:** [March 27, 2021, 2:00am UTC](https://discourse.julialang.org/t/problem-plotting-surfaces/58065/1 "2021-03-27T02:00:37Z")

</div>

Hello, there! I’m plotting a surface with the following code:

```julia
using Plots

θ = 1.5
K = J/θ

#3D plot
y=range(-2,stop=2)
θ=range(0.1,stop=2)
function f(y,θ)
    J = 1.0
    h = 0.0
    -θ*log(2.0) -θ*log(exp(-(J/θ)*y^2/2)*cosh((J/θ)*y+h))
end
plotlyjs()
p1=plot(y,θ,f,st=:surface,zlabel="f",ylabel="θ",xlabel="y",c=:blues)

```

The result is

 ![3d](https://global.discourse-cdn.com/julialang/original/3X/c/7/c7d8c9714a5c1d079143472d98bd5e59e45adee8.png)

I’m defining \theta \in (0.1,2.0), but the plot stops at \theta = 1.0. Can someone tell what is wrong?

---

<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:** [March 27, 2021, 2:10am UTC](https://discourse.julialang.org/t/problem-plotting-surfaces/58065/2 "2021-03-27T02:10:41Z")

</div>

julia\> range(0.1,stop=2)  
0.1:1.0:1.1

---

<div class="post-metadata">

**Author:** ![briochemc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/briochemc/32/4209_2.png) [@briochemc](https://discourse.julialang.org/u/briochemc)\
**Post date:** [March 27, 2021, 12:18pm UTC](https://discourse.julialang.org/t/problem-plotting-surfaces/58065/3 "2021-03-27T12:18:22Z")

</div>

As @rafael.guerra showed, the issue is with the `range` function. You’re probably better off using the nice `:` notation for ranges. Maybe try with

```julia
y = -2:0.1:2
θ = 0.1:0.1:2

```
