# Surface plot not showing up in script

**URL:** https://discourse.julialang.org/t/surface-plot-not-showing-up-in-script/8536
**Category:** General Usage
**Created:** [January 22, 2018, 10:01pm UTC](https://discourse.julialang.org/t/surface-plot-not-showing-up-in-script/8536 "2018-01-22T22:01:45Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![gideonsimpson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gideonsimpson/32/1928_2.png) [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)
#### Post date: [January 22, 2018, 10:01pm UTC](https://discourse.julialang.org/t/surface-plot-not-showing-up-in-script/8536/1 "2018-01-22T22:01:45Z")

</div>

with

```julia
using Plots; pyplot()

```

after I generate some gridded data, `xx`, `yy`, `zz`, I call

```julia
surface(xx,yy,zz)

```

Now, I find that if I run the script containing this code, the figure does not appear. If I include a `savefig`, the picture is generated as expected. If I call `show()` instead, the figure appears, but the data is never plotted.

---

<div class="post-metadata">

### Author: ![JackDevine](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jackdevine/32/1048_2.png) [@JackDevine](https://discourse.julialang.org/u/JackDevine)
#### Post date: [January 22, 2018, 10:14pm UTC](https://discourse.julialang.org/t/surface-plot-not-showing-up-in-script/8536/2 "2018-01-22T22:14:18Z")

</div>

This works for me:

```julia
julia> using Plots; pyplot()

shell> nano myplot.jl # Do some editing.

```

```julia
# File myplot.jl

xx = yy = linspace(0, 1, 10)
zz = [x^2 + sin(y) for x in xx, y in yy]

surface(xx, yy, zz)

```

```julia
julia> include("myplot.jl")

```

And then I get the plot.

---

<div class="post-metadata">

### Author: ![gideonsimpson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gideonsimpson/32/1928_2.png) [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)
#### Post date: [January 22, 2018, 11:09pm UTC](https://discourse.julialang.org/t/surface-plot-not-showing-up-in-script/8536/3 "2018-01-22T23:09:40Z")

</div>

I agree that works. What does not work for me is calling `julia myplot.jl` from the command line.

---

<div class="post-metadata">

### Author: ![JackDevine](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jackdevine/32/1048_2.png) [@JackDevine](https://discourse.julialang.org/u/JackDevine)
#### Post date: [January 23, 2018, 12:03am UTC](https://discourse.julialang.org/t/surface-plot-not-showing-up-in-script/8536/4 "2018-01-23T00:03:16Z")

</div>

I am not sure how to make that work to be honest. Although, is it 100% necessary that you run the script from the command line?

---

<div class="post-metadata">

### Author: ![piever](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/piever/32/1815_2.png) [@piever](https://discourse.julialang.org/u/piever)
#### Post date: [January 23, 2018, 12:20am UTC](https://discourse.julialang.org/t/surface-plot-not-showing-up-in-script/8536/5 "2018-01-23T00:20:49Z")

</div>

I’m not sure how one would get it to work from the command line but I’d like to point out that it’s actually not ideal to use Plots from the command line: the first plot is very slow due to precompilation and, if you call it from command line, you pay that cost every time. Using the REPL and running your file with `include(...)` is a much better user experience. If you need to use the command line, simply toggle it from the REPL typing `;`
