# Outdated example for Plots' "surface" command

**URL:** <https://discourse.julialang.org/t/outdated-example-for-plots-surface-command/35219>\
**Category:** New to Julia\
**Tags:** package, plotting\
**Created:** [February 27, 2020, 9:44am UTC](https://discourse.julialang.org/t/outdated-example-for-plots-surface-command/35219 "2020-02-27T09:44:01Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [February 27, 2020, 9:44am UTC](https://discourse.julialang.org/t/outdated-example-for-plots-surface-command/35219/1 "2020-02-27T09:44:01Z")

</div>

When I type “?surface” into the REPL, I get the following:

```julia
...
 Example
  ≡≡≡≡≡≡≡≡≡
julia> x = y = range(-3, 3, length = 100)
julia> surface(x, y, (x, y) -> sinc(norm([x, y])))

```

This example generates the following error:  
“UndefVarError: norm not defined”

Changing it to hypot does not help, because of some other error. The example is obviously outdated.

Is there someone who could easily fix this? It really does a lot to the feeling about the possibilities of getting help in Julia when the example does not work.

A working replacement is :

```julia
julia> x = y = range(-3, 3, length = 100)
julia> surface(x, y, (x, y) -> sin(x)*sin(y))

```

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [February 27, 2020, 10:03am UTC](https://discourse.julialang.org/t/outdated-example-for-plots-surface-command/35219/2 "2020-02-27T10:03:31Z")

</div>

> [@TheLateKronos](#):
>
> Can this be fixed asap?

You may not realize this, but asking that something, especially a trivial doc issue, is fixed “asap” in a free software project just strikes the wrong tone.

In this particular case, the best fix may be just adding `using LinearAlgebra`, which has `norm`. To get this fixed “asap”, the best course would be to do it yourself (in the form of a pull request)

> [@TheLateKronos](#):
>
> the feeling about the possibilities of getting help in Julia

Had you actually looked in the docs for `norm`, you would have [found it immediately](https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/#LinearAlgebra.norm).

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [February 27, 2020, 10:25am UTC](https://discourse.julialang.org/t/outdated-example-for-plots-surface-command/35219/3 "2020-02-27T10:25:11Z")

</div>

> [@TheLateKronos](#):
>
> surface(x, y, (x, y) → sinc(norm([x, y])))

That worked well! Thanks. When I tried changing norm into something that was defined (like hypot, which I though would do something similar) and it still did not work, I figured something bigger was wrong. My bad.

The reason for asking the fix to be asap is because it figured it would just be editing the right text file, which is a small enough thing to do to just do. I have never used github other that reading what is on there, never made a pull request, and have no idea on how I would change the help documentation. I am also new to the language and eager to make adoption easy, and I know of classmates (who I want to introduce to Julia as opposed to c++, python or MatLab) to whom that error would feel like running into a small brick wall.

You are of course right, and the asap-part of my request will be striken. I still feel that my point about how it feels to new users, and how (seemingly) easy it would be to fix, makes it a fair request (without the time-demanding part).

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [February 27, 2020, 10:34am UTC](https://discourse.julialang.org/t/outdated-example-for-plots-surface-command/35219/4 "2020-02-27T10:34:53Z")

</div>

> [@TheLateKronos](#):
>
> it would just be editing the right text file, which is a small enough thing to do to just do. I have never used github

In this particular case you can just click through buttons on Github to edit the docstring on a web interface and make a pull request that way.

> [@TheLateKronos](#):
>
> I want to introduce to Julia as opposed to c++, python or MatLab) to whom that error would feel like running into a small brick wall

I am not sure if you are joking here. For someone used to wading through compiler error messages from C++ or parsing Matlab docs with 17 different argument conventions for the same function, figuring out what `norm` is an how to find it should be trivially easy.

FWIW, I tried “julia norm” in various search engines and the _first_ result was [the right page](https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/index.html).

---

<div class="post-metadata">

**Author:** ![KronosTheLate](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kronosthelate/32/12763_2.png) [@KronosTheLate](https://discourse.julialang.org/u/KronosTheLate)\
**Post date:** [February 27, 2020, 3:11pm UTC](https://discourse.julialang.org/t/outdated-example-for-plots-surface-command/35219/5 "2020-02-27T15:11:10Z")

</div>

Yhea I know it is far from a tall order generally in programming, but we are only 7 months into a physics-bachelor so programming is really new to most. And when starting something like a new language, small problems can feel enourmus when you have not seen them before.

I’ll try and make that pull request myself, thanks for the high quality answers.

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [March 24, 2020, 2:48pm UTC](https://discourse.julialang.org/t/outdated-example-for-plots-surface-command/35219/6 "2020-03-24T14:48:21Z")

</div>

So I tried to figure out how to make the pull-request myself. It seems I have to download the file for the package from GitHub, make the change I want, and re-upload. Is that right? I tried locating the docs-file, but I can’t find it. Also I am not sure if the example should be updated, or a note about adding LinearAlgebra should be added. Feeling pretty lost, as I am wildly incompetent in this world as you may have noticed. If you find the time and will, feel free to make the necessary change. If not then I don’t know the right channel to notify whoever should know. Any point in the right direction is appriciated.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 25, 2020, 12:13pm UTC](https://discourse.julialang.org/t/outdated-example-for-plots-surface-command/35219/7 "2020-03-25T12:13:28Z")

</div>

> [@TheLateKronos](#):
>
> I have to download the file for the package from GitHub, make the change I want, and re-upload.

No, you should fork on Github, `pkg> dev` the forked URL, branch, commit, push, then submit a PR. This has been discussed in a few topics on this forum, eg

> [@Guide for contributing to julia package on Github](https://discourse.julialang.org/t/guide-for-contributing-to-julia-package-on-github/17401):
>
> Hey, so, since 1.0 I am really confused about the recommended workflow for contributing to julia packages which are being developed on [GitHub.com](http://GitHub.com). Is there any documentation on the entire process? I forked and cloned the package I want to sent a PR to (NLSolversBase.jl) but activate . in my local clone does not seem to do the job since the Project.toml is missing. I am a just totally confused right now since the CI is of the package seems to work fine for 1.0. Can anybody enlighten me as to w…

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [March 25, 2020, 6:41pm UTC](https://discourse.julialang.org/t/outdated-example-for-plots-surface-command/35219/8 "2020-03-25T18:41:23Z")

</div>

FYI I have made the PR here: [Add LinearAlgebra to make example with `norm` work by nilshg · Pull Request #2504 · JuliaPlots/Plots.jl · GitHub](https://github.com/JuliaPlots/Plots.jl/pull/2504)

@TheLateKronos in this case as Tamas said it was enough to use the GitHub web interface - click `Fork` on the Plots repo (top right corner), then navigate to the file in question in your forked repo (here `shorthands.jl`), click the little `edit` pen symbol on the top of your file, make the change you want, save it, then press `Pull request` on the overview page of your forked repo and you’re done.

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [March 26, 2020, 9:59am UTC](https://discourse.julialang.org/t/outdated-example-for-plots-surface-command/35219/9 "2020-03-26T09:59:21Z")

</div>

Thanks for your patience. I will definitely do this myself next time I want to commit anything.

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [March 26, 2020, 10:04am UTC](https://discourse.julialang.org/t/outdated-example-for-plots-surface-command/35219/10 "2020-03-26T10:04:26Z")

</div>

Looks perfect, thanks a lot. Tried navigating through and it all seemed okay to do myself next time. One question though - how did you locate the help-tip for “surface” in “shorthands”? I had no idea where to look for the file, and got lost quickly myself.

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [March 26, 2020, 2:52pm UTC](https://discourse.julialang.org/t/outdated-example-for-plots-surface-command/35219/11 "2020-03-26T14:52:59Z")

</div>

Top left corner, the search box - if you type something into it, the default search will search in that repo only. So simply searching for `sinc(norm([x, y]))` was enough

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [March 29, 2020, 8:05am UTC](https://discourse.julialang.org/t/outdated-example-for-plots-surface-command/35219/12 "2020-03-29T08:05:38Z")

</div>

Ofc, searching for something you know to be in the location you are looking for. Nice, thanks!

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [September 16, 2020, 6:52am UTC](https://discourse.julialang.org/t/outdated-example-for-plots-surface-command/35219/13 "2020-09-16T06:52:54Z")

</div>

I did a thing! I have tried to follow your advice, and it has gotten me to this:  
[https://github.com/JuliaControl/ControlSystems.jl/pull/316](https://github.com/JuliaControl/ControlSystems.jl/pull/316)  
I know that it should probably have been done in a single commit, but I only spotted the last 2 occurances after making the first one. If this all looks good, then thanks a lot for your help, I could not have done it alone 😃

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [September 16, 2020, 7:50am UTC](https://discourse.julialang.org/t/outdated-example-for-plots-surface-command/35219/14 "2020-09-16T07:50:05Z")

</div>

> [@TheLateKronos](#):
>
> should probably have been done in a single commit, but I only spotted the last 2 occurances after making the first one

Don’t worry about that, that’s what git squash is for.

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [September 16, 2020, 6:48pm UTC](https://discourse.julialang.org/t/outdated-example-for-plots-surface-command/35219/15 "2020-09-16T18:48:32Z")

</div>

> [@Tamas\_Papp](#):
>
> Don’t worry about that, that’s what git squash is for.

Uuuh, fancy. Cool stuff. I really love the open source spirit, and I am so happy to contribute 😃
