JuliaPy / PyPlot.jl

Plotting for Julia based on matplotlib.pyplot
https://github.com/JuliaPy/PyPlot.jl
MIT License
469 stars 85 forks source link

Displaying plots in vscode #576

Open CNelias opened 5 months ago

CNelias commented 5 months ago

Whenever I try to plot something using PyPlot.jl, nothing is displayed and only a 1-element Vector{PyCall.PyObject}: PyObject <matplotlib.lines.Line2D object at 0x00000274756122C0> element is returned.

I also tried p = plot(...); show(p), and p = plot(...); display(p) but I get nothing.

Plotting with Plots.jl works fine though. Is this a known issue or did I miss something?

I am running julia with vs code, I have julia 1.10 and the latest version of pyplot.jl.

stevengj commented 5 months ago

You need to display the Figure object. Use gcf() after your plot command (which returns the current figure object), or display(gcf()).

stevengj commented 5 months ago

(See also #530.)