Home > Software design >  How to plot julia inline when using Jupyter in vscode?
How to plot julia inline when using Jupyter in vscode?

Time:07-21

I am trying to use Jupyter for Julia in vscode:

using PyPlot

a = [1,2]
b = [2,3]
fig=figure(1)
PyPlot.plot(a, b, linewidth=1)
PyPlot.scatter(a, b)

show()

When I run this a new window will pop up. What I want to do is to prevent it to pop up and see the picture below my codes. After doing some search it seems in Python you can solve it by %matplotlib inline, but how do I sovle it in Julia?

CodePudding user response:

Try gcf() instead of show. gcf yields the current PyPlot Figure object and it will be automatically rendered by Jupyter:

enter image description here

  • Related