# Trying to plot, getting no output

**URL:** <https://discourse.julialang.org/t/trying-to-plot-getting-no-output/98136>\
**Category:** New to Julia\
**Tags:** package, plotting\
**Created:** [April 30, 2023, 6:09pm UTC](https://discourse.julialang.org/t/trying-to-plot-getting-no-output/98136 "2023-04-30T18:09:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jxxcarlson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jxxcarlson/32/49405_2.png) [@jxxcarlson](https://discourse.julialang.org/u/jxxcarlson)\
**Post date:** [April 30, 2023, 6:09pm UTC](https://discourse.julialang.org/t/trying-to-plot-getting-no-output/98136/1 "2023-04-30T18:09:52Z")

</div>

I’m running the code below (using Julia 1.8.5) but getting no output other than the below. That is, I don’t see any plot popping up.

```julia
➜ julia julia plot-sine.jl
    Updating registry at `~/.julia/registries/General`
   Resolving package versions...
  No Changes to `~/.julia/environments/v1.8/Project.toml`
  No Changes to `~/.julia/environments/v1.8/Manifest.toml`
   Resolving package versions...
  No Changes to `~/.julia/environments/v1.8/Project.toml`
  No Changes to `~/.julia/environments/v1.8/Manifest.toml`

```

Here is the code:

```julia
import Pkg; Pkg.add("Plots"); Pkg.add("PyPlot") # or Pkg.add("PlotlyJS")
using Plots
pyplot() # or plotlyjs()
plot(sin, -2pi, pi, label="sine function")

```

**Addendum.**. I changed the last part of the code to

```julia
plt = plot(sin, -2pi, pi, label="sine function")
display(plt)

```

Now a plot flashes onto the screen for a fraction of a second, then disappears. No doubt  
because the program has terminated.

**Addendum 2.**. OK, I fixed it: run with `julia -i`

---

<div class="post-metadata">

**Author:** ![albheim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albheim/32/34660_2.png) [@albheim](https://discourse.julialang.org/u/albheim)\
**Post date:** [April 30, 2023, 6:48pm UTC](https://discourse.julialang.org/t/trying-to-plot-getting-no-output/98136/2 "2023-04-30T18:48:08Z")

</div>

You can also try `wait(display(plot(...)))` if you don’t want to run it interactively.

---

<div class="post-metadata">

**Author:** ![jxxcarlson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jxxcarlson/32/49405_2.png) [@jxxcarlson](https://discourse.julialang.org/u/jxxcarlson)\
**Post date:** [May 1, 2023, 12:11am UTC](https://discourse.julialang.org/t/trying-to-plot-getting-no-output/98136/3 "2023-05-01T00:11:25Z")

</div>

Excellent! That is what I will do.
