# How to plot outside VS Code?

**URL:** <https://discourse.julialang.org/t/how-to-plot-outside-vs-code/47242>\
**Category:** VS Code\
**Created:** [September 25, 2020, 5:12am UTC](https://discourse.julialang.org/t/how-to-plot-outside-vs-code/47242 "2020-09-25T05:12:26Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![cricci](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cricci/32/25160_2.png) [@cricci](https://discourse.julialang.org/u/cricci)\
**Post date:** [September 25, 2020, 5:12am UTC](https://discourse.julialang.org/t/how-to-plot-outside-vs-code/47242/1 "2020-09-25T05:12:26Z")

</div>

I noticed that in the plugin Julia there is the option to plot outside VSCode instead of using the plot pane.  
 ![Screenshot](https://global.discourse-cdn.com/julialang/original/3X/d/1/d1ba0f23cba0c80e68451a6f56390052be7c9a15.png)  
This in my mind should create a plot window as when I makes plot directly form the julia console (not inside the REPL of VSCode).  
However nothings happens. The REPL stutters a bit when you try to make the first plot, just as it happens when you make the first plots in other situations, but then nothing happens.

Using Linux Here, with Julia 1.5.2

[Why I want this? Apart that I prefer to have a separate window instead that the plot pane, usually the plot pane is a bit slower/tends to not display everything it should (my scripts usually do plots inside a for loop at runtime, updating constantly). As a temporary workaround I am doing all my plots outside the VSCode REPL, that shows plots correctly]

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [September 25, 2020, 8:03am UTC](https://discourse.julialang.org/t/how-to-plot-outside-vs-code/47242/2 "2020-09-25T08:03:51Z")

</div>

I think you need to restart your current Julia process for that setting to take effect.  
We’ll definitely look into making that a bit smoother at some point though!

---

<div class="post-metadata">

**Author:** ![cricci](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cricci/32/25160_2.png) [@cricci](https://discourse.julialang.org/u/cricci)\
**Post date:** [September 25, 2020, 8:12am UTC](https://discourse.julialang.org/t/how-to-plot-outside-vs-code/47242/3 "2020-09-25T08:12:03Z")

</div>

I did indeed! I already thought that could be a thing, but sadly it had no effect.

---

<div class="post-metadata">

**Author:** ![maxfreu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maxfreu/32/17468_2.png) [@maxfreu](https://discourse.julialang.org/u/maxfreu)\
**Post date:** [November 5, 2020, 4:37pm UTC](https://discourse.julialang.org/t/how-to-plot-outside-vs-code/47242/4 "2020-11-05T16:37:33Z")

</div>

I have exactly the same problem. I cant get a standalone `Plots.jl` plot whatever I do. this might be a vscode bug. (?) I have julia 1.5.0, vscode 1.50.1, Plots.jl 1.7.3 and extension version 1.0.8.

---

<div class="post-metadata">

**Author:** ![brett\_knoss](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brett_knoss/32/13050_2.png) [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Post date:** [November 10, 2020, 8:32pm UTC](https://discourse.julialang.org/t/how-to-plot-outside-vs-code/47242/5 "2020-11-10T20:32:26Z")

</div>

One way would be to use something like Gnuplots, and save the plot as a .png. Also why do you want the Plot outside Julia? with Weave.jl you can convert a Julia Markdown to LaTeX for editing and publishing .pdf s or to .html, for creating web pages.

---

<div class="post-metadata">

**Author:** ![cricci](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cricci/32/25160_2.png) [@cricci](https://discourse.julialang.org/u/cricci)\
**Post date:** [November 10, 2020, 9:37pm UTC](https://discourse.julialang.org/t/how-to-plot-outside-vs-code/47242/6 "2020-11-10T21:37:19Z")

</div>

> [@brett\_knoss](#):
>
> Also why do you want the Plot outside Julia?

Actually I just would like to plot outside VScode 😀

---

<div class="post-metadata">

**Author:** ![brett\_knoss](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brett_knoss/32/13050_2.png) [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Post date:** [November 10, 2020, 10:11pm UTC](https://discourse.julialang.org/t/how-to-plot-outside-vs-code/47242/7 "2020-11-10T22:11:32Z")

</div>

I’m not sure I get what you mean. Do you mean in another type of document? or a different editor, such as using plain text?

---

<div class="post-metadata">

**Author:** ![cricci](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cricci/32/25160_2.png) [@cricci](https://discourse.julialang.org/u/cricci)\
**Post date:** [November 10, 2020, 10:43pm UTC](https://discourse.julialang.org/t/how-to-plot-outside-vs-code/47242/8 "2020-11-10T22:43:13Z")

</div>

I am sorry if I was not very clear. As explained before the original problem is what happens when I plot from the julia REPL inside vscode. If I thick the option “use plot pane” as in the first post it really uses the plot pane. But it is really slow, so I would simply like to plot with a different gtk window, as when I open julia from a vanilla terminal and run plot from there (but with all the features and advantages of the REPL inside vscode)

---

<div class="post-metadata">

**Author:** ![brett\_knoss](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brett_knoss/32/13050_2.png) [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Post date:** [November 10, 2020, 10:45pm UTC](https://discourse.julialang.org/t/how-to-plot-outside-vs-code/47242/9 "2020-11-10T22:45:20Z")

</div>

Ok, I probably would like to do that too. It does seem to be a bit slow. I’ve been doing most everything inside VS though.

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [November 11, 2020, 9:06am UTC](https://discourse.julialang.org/t/how-to-plot-outside-vs-code/47242/10 "2020-11-11T09:06:49Z")

</div>

IIRC the display handling is broken in the latest normal release. Insiders has a fix for that, in case you wanna give it a go.

---

<div class="post-metadata">

**Author:** ![jmo](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@jmo](https://discourse.julialang.org/u/jmo)\
**Post date:** [December 10, 2020, 12:15am UTC](https://discourse.julialang.org/t/how-to-plot-outside-vs-code/47242/11 "2020-12-10T00:15:13Z")

</div>

Any news on this problem?

I have a similar problem using PyPlot. When I run a script in vscode using eg shift return the script runs without error but I do not get any plots. Not external from vs code and not in a plot pane. It used to work before.

If I start a new julia REPL in vscode and paste in the same code it works fine.

---

<div class="post-metadata">

**Author:** ![tchr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tchr/32/15138_2.png) [@tchr](https://discourse.julialang.org/u/tchr)\
**Post date:** [December 10, 2020, 12:34am UTC](https://discourse.julialang.org/t/how-to-plot-outside-vs-code/47242/12 "2020-12-10T00:34:47Z")

</div>

If you are using PyPlot, then calling `pygui(true)` before issuing your plot commands might do the trick (it does for me in VSCode at least; but this wasn’t always necessary - seems to have changed at some point during the last few months?).

---

<div class="post-metadata">

**Author:** ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Post date:** [December 10, 2020, 4:49am UTC](https://discourse.julialang.org/t/how-to-plot-outside-vs-code/47242/13 "2020-12-10T04:49:11Z")

</div>

You could try [ElectronDisplay.jl](https://github.com/queryverse/ElectronDisplay.jl).

```julia
julia> using Plots, ElectronDisplay

julia> scatter(1:4) |> electrondisplay()

```

---

<div class="post-metadata">

**Author:** ![gcalderone](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gcalderone/32/1539_2.png) [@gcalderone](https://discourse.julialang.org/u/gcalderone)\
**Post date:** [December 10, 2020, 9:06am UTC](https://discourse.julialang.org/t/how-to-plot-outside-vs-code/47242/14 "2020-12-10T09:06:47Z")

</div>

If `Plots.jl` is not a requirement you may use [Gnuplot.jl](https://github.com/gcalderone/Gnuplot.jl/) as follows:

```julia
using Gnuplot
Gnuplot.options.gpviewer = true # to avoid using plot pane
@gp rand(100)

```

It will open a separate window (running in a separate process) showing the plot, with no temporary file involved, mouse tracking / zooming, and possibility to export the plot in several formats.

Another option is to use [Gaston.jl](https://github.com/mbaz/Gaston.jl), which also relies on gnuplot, and [may become](https://github.com/JuliaPlots/Plots.jl/pull/3177) a Plots.jl backend in the near future.

---

<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:** [December 10, 2020, 12:09pm UTC](https://discourse.julialang.org/t/how-to-plot-outside-vs-code/47242/15 "2020-12-10T12:09:14Z")

</div>

No problem for me in Win10, Julia 1.5.3 and `using Plots`. After unchecking in VS Code options the “Display plots within vscode” and restarting Julia, the first plot opened in a new window labelled “GKS QtTerm”

---

<div class="post-metadata">

**Author:** ![jmo](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@jmo](https://discourse.julialang.org/u/jmo)\
**Post date:** [December 10, 2020, 2:21pm UTC](https://discourse.julialang.org/t/how-to-plot-outside-vs-code/47242/16 "2020-12-10T14:21:20Z")

</div>

Thanks! Running pygui(true) solved my problem.  
Now plots show up in an external window again. I have no idea why I didn’t need the pygui(true) before and on another machine the same code runs just fine without it.

---

<div class="post-metadata">

**Author:** ![bionicinnovations](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bionicinnovations/32/6065_2.png) [@bionicinnovations](https://discourse.julialang.org/u/bionicinnovations)\
**Post date:** [May 10, 2023, 11:26pm UTC](https://discourse.julialang.org/t/how-to-plot-outside-vs-code/47242/17 "2023-05-10T23:26:08Z")

</div>

> [@CameronBieganek](#):
>
> `electrondisplay`

This is a great option thanks! I found it didn’t work with the `()`, it worked like this:

```julia
scatter(1:4) |> electrondisplay

```

or

```julia
electrondisplay(scatter(1:4))

```

---

<div class="post-metadata">

**Author:** ![Soldalma](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/soldalma/32/29388_2.png) [@Soldalma](https://discourse.julialang.org/u/Soldalma)\
**Post date:** [June 4, 2023, 10:58am UTC](https://discourse.julialang.org/t/how-to-plot-outside-vs-code/47242/18 "2023-06-04T10:58:49Z")

</div>

In my experience once the packages Plots and ElectronDisplay are loaded with using it is enough to do

```julia
scatter(1:4)

```
