Running latest vscode julia extension 1.65.2 with julia 1.10, the following code will run in the (vscode) julia terminal, with the plot appearing in the web browser, but, if run in the vscode editor, it does not plot in the vscode plot pane. Instead, I get a message in the plot pane that “WebGL is not supported by your browser”
f(x,y) = -(3*(1-x)^2 * exp(-(x^2) - (y+1)^2)
- 6*(x/5 - x^3 - y^5) * exp(-x^2 - y^2)
- 1/3 * exp(-(x+1)^2 - y^2))
##
# let's explore it:
using Plots
plotly() # this backend makes nice 3d plots
x = range(-4, step=0.1, stop=4)
y = x
surface(x, y, (x,y)->f(x,y),c=:viridis)
xlabel!("x")
ylabel!("y")
Yes, I have the same problem.
What I can say is that it used to work, but I don’t know why it doesn’t work anymore.
for me, it’s PlotlyJS that shows this exact behavior, but it worked before
If anyone can help me, that would be great, otherwise we should learn to trace using Mackie.
This code runs fine from the REPL, and the plot appears in Google Chrome. So, there is no browser problem.
However, if the code is run from VScode’s edit pane, the plot does not appear in the plot pane, and the error message that I mentioned appears instead. In the past, the plot did appear in the plot pane.
I don’t have this problem on my HP laptop, but it happens on my desktop computer, which is some kind of game console I have. That isn’t made by a company, someone put together a GeForce with an AMD processor and sold it.
I’m really starting not to trust this kind of device for my humble research work anymore maybe it has something to do with that Nvidia being for games only?
I don’t know if this is a problem with the VScode extension, with Plots.jl, or with the plotly() backend as used by Plots.jl. If Someone knows, I can file a proper bug report in the correct place.
To summarize, the code at the end of this message works correctly from the Julia REPL, but it does not produce a plot in the VScode plot pane. Instead, in the plot pane, the message “WebGL is not supported by your browser” is shown. In the past, the code produced a surface plot in the plot pane.
Versions are
julia> versioninfo()
Julia Version 1.10.0
Commit 3120989f39b (2023-12-25 18:01 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 8 × Intel(R) Core™ i5-10210U CPU @ 1.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, skylake)
Threads: 1 on 8 virtual cores
The packages in the Project.toml are:
(plotly) pkg> st
Status ~/Desktop/plotly/Project.toml
[58dd65bb] Plotly v0.4.1
[91a5bcdd] Plots v1.39.
VScode julia extension 1.66.2
using Pkg
Pkg.activate(@__DIR__)
f(x,y) = -(3*(1-x)^2 * exp(-(x^2) - (y+1)^2)
- 6*(x/5 - x^3 - y^5) * exp(-x^2 - y^2)
- 1/3 * exp(-(x+1)^2 - y^2))
##
# let's explore it:
using Plots
plotly() # this backend makes nice 3d plots
x = range(-4, step=0.1, stop=4)
y = x
surface(x, y, (x,y)->f(x,y),c=:viridis)
xlabel!("x")
ylabel!("y")
Just fine on Jupyter or JupyterLab as s explained by @benz0li
When it comes to Vscode :
the @benz0li small code works fine on a machine like Dell or HP, but not anymore with my anonymous box using GeForce and AMD processor
I’m also using Debian, testing, with the same Julia, VScode and julia extension for Vscode, and same Plots. I don’t know the role of IJulia in this, though, I don’t use it.
The problem I’m seeing is when using the installable version of VScode, which uses the plot pane. I would like to solve the problem on that setup, because it is what most of my students use. Actually, they will mostly be using Windows, and I’m not sure if the problem occurs on Windows.