# Surface command in Julia

**URL:** <https://discourse.julialang.org/t/surface-command-in-julia/66378>\
**Category:** Performance\
**Tags:** plotting\
**Created:** [August 14, 2021, 8:10am UTC](https://discourse.julialang.org/t/surface-command-in-julia/66378 "2021-08-14T08:10:04Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manisha\_07](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@Manisha\_07](https://discourse.julialang.org/u/Manisha_07)\
**Post date:** [August 14, 2021, 8:10am UTC](https://discourse.julialang.org/t/surface-command-in-julia/66378/1 "2021-08-14T08:10:04Z")

</div>

```julia
MethodError: no method matching optimize_ticks(::Float64, ::Float64; k_min=4, k_max=8, scale=:identity)
Closest candidates are:
  optimize_ticks(::T, ::T; extend_ticks, Q, k_min, k_max, k_ideal, granularity_weight, simplicity_weight, coverage_weight, niceness_weight, strict_span, span_buffer) where T at C:\Users\manis\.julia\packages\PlotUtils\es5pb\src\ticks.jl:129 got unsupported keyword argument "scale"

Stacktrace:
  [1] kwerr(::NamedTuple{(:k_min, :k_max, :scale), Tuple{Int64, Int64, Symbol}}, ::Function, ::Float64, ::Float64)
    @ Base .\error.jl:157
  [2] optimal_ticks_and_labels(ticks::Nothing, alims::Tuple{Float64, Float64}, scale::Symbol, formatter::Symbol)
    @ Plots ~\.julia\packages\Plots\G6ceC\src\axes.jl:172
  [3] get_ticks(::Symbol, ::Vector{Float64}, ::Vector{Any}, ::Tuple{Float64, Float64}, ::Vararg{Any, N} where N)
    @ Plots ~\.julia\packages\Plots\G6ceC\src\axes.jl:313
  [4] get_ticks(sp::Plots.Subplot{Plots.GRBackend}, axis::Plots.Axis; update::Bool)
    @ Plots ~\.julia\packages\Plots\G6ceC\src\axes.jl:234
  [5] get_ticks
    @ ~\.julia\packages\Plots\G6ceC\src\axes.jl:223 [inlined]
  [6] _update_min_padding!(sp::Plots.Subplot{Plots.GRBackend})
    @ Plots ~\.julia\packages\Plots\G6ceC\src\backends\gr.jl:766
  [7] iterate
    @ .\generator.jl:47 [inlined]
  [8] _collect(c::Matrix{AbstractLayout}, itr::Base.Generator{Matrix{AbstractLayout}, typeof(Plots._update_min_padding!)}, #unused#::Base.EltypeUnknown, isz::Base.HasShape{2})
    @ Base .\array.jl:691
  [9] collect_similar
    @ .\array.jl:606 [inlined]
 [10] map
    @ .\abstractarray.jl:2294 [inlined]
 [11] _update_min_padding!(layout::Plots.GridLayout)
    @ Plots ~\.julia\packages\Plots\G6ceC\src\layouts.jl:282
 [12] prepare_output(plt::Plots.Plot{Plots.GRBackend})
    @ Plots ~\.julia\packages\Plots\G6ceC\src\plot.jl:224
 [13] show(io::IOBuffer, m::MIME{Symbol("image/svg+xml")}, plt::Plots.Plot{Plots.GRBackend})
    @ Plots ~\.julia\packages\Plots\G6ceC\src\output.jl:214
 [14] sprint(::Function, ::MIME{Symbol("image/svg+xml")}, ::Vararg{Any, N} where N; context::Nothing, sizehint::Int64)
    @ Base .\strings\io.jl:105
 [15] sprint
    @ .\strings\io.jl:101 [inlined]
 [16] _ijulia_display_dict(plt::Plots.Plot{Plots.GRBackend})
    @ Plots ~\.julia\packages\Plots\G6ceC\src\ijulia.jl:53
 [17] display_dict(plt::Plots.Plot{Plots.GRBackend})
    @ Plots ~\.julia\packages\Plots\G6ceC\src\init.jl:82
 [18] #invokelatest#2
    @ .\essentials.jl:708 [inlined]
 [19] invokelatest
    @ .\essentials.jl:706 [inlined]
 [20] execute_request(socket::ZMQ.Socket, msg::IJulia.Msg)
    @ IJulia ~\.julia\packages\IJulia\e8kqU\src\execute_request.jl:112
 [21] #invokelatest#2
    @ .\essentials.jl:708 [inlined]
 [22] invokelatest
    @ .\essentials.jl:706 [inlined]
 [23] eventloop(socket::ZMQ.Socket)
    @ IJulia ~\.julia\packages\IJulia\e8kqU\src\eventloop.jl:8
 [24] (::IJulia.var"#15#18")()
    @ IJulia .\task.jl:406

```

Hello Guys When trying to use “ **surface** ” I am getting this error  
Please help.It is very urgent  
Thanks in Advance

---

<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:** [August 14, 2021, 10:16am UTC](https://discourse.julialang.org/t/surface-command-in-julia/66378/2 "2021-08-14T10:16:48Z")

</div>

Hello @Manisha_07, this is not the first time members of this forum have asked you to follow the recommended [guidelines](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757) and post a MWE.

To respect the time of others and increase your chances to get the help requested, please try to do so.

---

<div class="post-metadata">

**Author:** ![bvrb](https://avatars.discourse-cdn.com/v4/letter/b/76d3ee/32.png) [@bvrb](https://discourse.julialang.org/u/bvrb)\
**Post date:** [August 14, 2021, 10:33am UTC](https://discourse.julialang.org/t/surface-command-in-julia/66378/3 "2021-08-14T10:33:04Z")

</div>

At least for me, the `surface` command from the Plots package works fine. To find out why it doesn’t work in your case, you should provide more information on what exactly you tried and the packages in your environment, as requested above.

A quick guess though: It seems that you might be using a newer version of Plots together with an older, incompatible version of PlotUtils, have you tried updating the latter?

---

<div class="post-metadata">

**Author:** ![genkuroki](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/genkuroki/32/18030_2.png) [@genkuroki](https://discourse.julialang.org/u/genkuroki)\
**Post date:** [August 15, 2021, 6:51am UTC](https://discourse.julialang.org/t/surface-command-in-julia/66378/4 "2021-08-15T06:51:10Z")

</div>

The questioner must provide all information to reproduce the error, in particular, the minimal working code that can be simply copy-and-pasted and executed.

The following code probably reproduces the error. See [Mesh grid in Julia - #3 by genkuroki](https://discourse.julialang.org/t/mesh-grid-in-julia/66363/3)

```julia
using Plots

f(t, x) = exp(-x^2/(2t))/√(2π*t)
u(t, x) = f(t+0.1, x+2) + 2f(t+0.2, x-2)
t = range(0, 3; length=101)
x = range(-5, 5; length=101)
T = u.(t', x)

surface(t, x, T; colorbar=false,
    xlabel="t", ylabel="x", zlabel="T",
    camera=(30, 70), color=reverse(cgrad(:RdYlBu_11)))

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/d/0/d09ef6399ccbd401969257a15ccbc60c1ec47f7e.jpeg)

The code above works fine in my Windows 10 environment.

Versions of packages:

```julia
@show VERSION
using Pkg
Pkg.status("Plots")
Pkg.status("PlotUtils"; mode=PKGMODE_MANIFEST)
Pkg.status("GR"; mode=PKGMODE_MANIFEST)

```

```julia
VERSION = v"1.6.2"
      Status `D:\OneDrive\public\0015\Surrogates\Project.toml`
  [91a5bcdd] Plots v1.20.1
      Status `D:\OneDrive\public\0015\Surrogates\Manifest.toml`
  [995b91a9] PlotUtils v1.0.11
      Status `D:\OneDrive\public\0015\Surrogates\Manifest.toml`
  [28b8d3ca] GR v0.58.1

```

cf. [Mesh grid in Julia - #7 by Manisha\_07](https://discourse.julialang.org/t/mesh-grid-in-julia/66363/7)

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [August 15, 2021, 9:47am UTC](https://discourse.julialang.org/t/surface-command-in-julia/66378/5 "2021-08-15T09:47:32Z")

</div>

@Manisha_07 Please run the Pkg status commands in the last reply. Please let us know the results.

---

<div class="post-metadata">

**Author:** ![Manisha\_07](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@Manisha\_07](https://discourse.julialang.org/u/Manisha_07)\
**Post date:** [August 15, 2021, 10:34pm UTC](https://discourse.julialang.org/t/surface-command-in-julia/66378/6 "2021-08-15T22:34:02Z")

</div>

Hello  
Thanks for the reply.I used Pkg status commands and it is working

---

<div class="post-metadata">

**Author:** ![genkuroki](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/genkuroki/32/18030_2.png) [@genkuroki](https://discourse.julialang.org/u/genkuroki)\
**Post date:** [August 16, 2021, 2:31am UTC](https://discourse.julialang.org/t/surface-command-in-julia/66378/7 "2021-08-16T02:31:30Z")

</div>

What is the version of PlotUtils.jl you are using?

See the following comments:

> [@bvrb](#):
>
> A quick guess though: It seems that you might be using a newer version of Plots together with an older, incompatible version of PlotUtils, have you tried updating the latter?

> [@johnh](#):
>
> Please run the Pkg status commands in the last reply. Please let us know the results.

Please let us know the results (= outputs).

The `optimize_ticks` function that gave you the error is defined in [PlotUtils.jl/src/ticks.jl](https://github.com/JuliaPlots/PlotUtils.jl/blob/master/src/ticks.jl).

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [August 16, 2021, 5:55am UTC](https://discourse.julialang.org/t/surface-command-in-julia/66378/8 "2021-08-16T05:55:05Z")

</div>

@Manisha_07 You are supposed to run the command and paste the results into a reply.

Please do the following for us: tell us a bit about yourself and why you are using Julia.  
To explain, open source software is a gift economy. People here give help for free, but it is polite to give something in return. That something might be the solution to your problem. It might be helping someone else when you see the same problem. It could be fixing a bug or making an enhancement to Julia. Or it may be telling us how you use Julia.
