Surface/mesh/wireframe with only the coordinates

I have a ton of x,y,z coordinates, and I need to represent them graphically. This could be as either a mesh, contour plot, wireframe, or surface. Julia doesn’t really argue with me; everything compiles. But I get a blank graph at best and just Figure() at worst. Here’s what I have edited only so you have the same number of points.

using GLMakie

x = LinRange(-600.0,600.0,62001)
y = LinRange(-600.0,600.0,62001)
z = LinRange(-600.0,600.0,62001)

frigg = Figure(resolution = (1600,800))

axus = Axis3(frigg[1,1], xlabel="x-error", ylabel = "y-error", zlabel = "z-error", title = "RSS Error")

mesh!(axus,x,y,z, color=:red, transparency = false)

I hope I provided enough information to replicate the issue. I can also share a link to a dropbox with ALL of the code if that is better, please just let me know if that is the case. Thank you.

mesh! needs points with some structure, for example here are some triangles:

using GLMakie

x = LinRange(-600.0,600.0,62001)
y = LinRange(-600.0,600.0,62001)
z = LinRange(-600.0,600.0,62001)

frigg = Figure(resolution = (1600,800))

axus = Axis3(frigg[1,1], xlabel="x-error", ylabel = "y-error", zlabel = "z-error", title = "RSS Error")

m = mesh!(axus, ones(Float32, 10), 1:10, (1:10) .+ ((1:10) .% 2))

If you have unstructured points, scatter! is a better tool.

delete!(axus.scene, m) # remove the mesh created above
plt = scatter!(axus, x, y, z, color=:red, transparency=false)

when I use scatter! I get an empty plot. I’m not quite sure why

It may be a graphics card issue or perhaps just an occlusion problem (maybe even a bug?), try rotating the axis around.

I’m operating out of a Jupyter notebook. I assume you’re saying to pop out a window and interact in that way? I have a GTX750. Is that powerful enough (I know it’s on the older side)? If not, should I try implementing this in Plots? I’m not super familiar with that tbh but I can give it a shot.

1 Like

I just used a laptop GPU, so I suspect yours is good enough. I did not try Jupyter, I used the REPL. I rarely use Jupyter, but I suggest sharing the full notebook and perhaps someone more knowledgeable than me can spot the problem, I know plotting in Jupyter can be complicated.

But it worked in the REPL? That’s good to know. Thank you.

A link to a zip file containing the entire relevant code base. Everything should build (assuming you have all the relevant packages installed). The only issue I’m having is plotting the data at the end of the notebook H3.
ETA: I have extracted the relevant bits of code and wrote a Julia script which I then executed in the REPL. A pop-out, interactive window does appear, but it is still blank.

OK, this might be a problem with your graphics card, your notebook works as written on my laptop. Does it work if you reduce the resolution of points tested (for example by 50 instead of by 5 in cell 14)?

Another option would be changing using GLMakie to using CairoMakie, this does work for me and I again see output for all plots.

I tried to get WGLMakie working, but I couldn’t get any output from it, it would be very nice to get that going for this notebook so you could have interactive plots.

Nice to see someone from WPI! I participated in the NASA Sample Return challenge years ago and have fond memories of the competition at your beautiful campus.

1 Like

Glad you enjoyed your visit! I’ll try taking your suggestions. I was of the understanding that CairoMakie didn’t output 3D plots. Has that changed?

Can you open an issue with more information?

CairoMakie does plot points in 3D, but it doesn’t handle z-ordering. Sometimes this is OK, sometimes it just makes a mess of the plot.

Well, I made a minimal example that didn’t work yesterday (at home) and it does this morning (at work). I think perhaps I got something in a bad state by following the instructions to run JSServe.Page(), the key to getting things to work was leaving that out. Is it possible that WGLMakie has trouble when the machine does not have an IPV4 address? Sometimes my home cable modem only assigns an IPV6 address and it takes me a while to figure out why some things don’t work.

Here is the notebook I was playing with.

Sadly, Pluto/IJulia support isn’t perfect yet, so one should read the docs to see how to set things up:
https://docs.makie.org/stable/documentation/backends/wglmakie/#plutoijulia

Yeah, that’s were I started. Those instructions did not work, just using WGLMakie sometimes works.

Can describe what you did and what happened? Did you make sure to display Page before anything else and restart the whole notebook if you happened to not display Page before anything else?

Here is a simple example I can’t get to work. Julia version 1.8.2, IJulia version 1.23.3, Firefox 104.0.2. I am surprised this didn’t work, because I was pretty sure I had seen it work before.

I created a new notebook with two cells:

begin
    using Pkg
    Pkg.activate(mktempdir())
    Pkg.add("JSServe")
    Pkg.add("WGLMakie")
    using JSServe
    Page()
end
using WGLMakie
scatter(rand(10), rand(10), rand(10))

I saw this error in the web browser console after running the first cell:

Uncaught ReferenceError: JSServe is not defined
    <anonymous> Untitled.ipynb line 2 > injectedScript:5
    jQuery 3
    _safe_append outputarea.js:458
    append_execute_result outputarea.js:497
    append_output outputarea.js:325
    handle_output outputarea.js:256
    output codecell.js:399
    _handle_output_message kernel.js:1199
    r jQuery
    _handle_iopub_message kernel.js:1239
    _finish_ws_message kernel.js:1018
    _msg_queue kernel.js:1009
    promise callback*Kernel.prototype._handle_ws_message kernel.js:1009
    r jQuery

And this error in the log messages in the notebook after running the second cell

┌ Warning: Waiting for page sessions to load.
│                 This can happen for the first cells to run, or is indicative of faulty state
└ @ JSServe /home/russel/.julia/packages/JSServe/kIK9q/src/display.jl:162

Hm looks correct, so might be a genuine bug/regression…

Update: Definitely a rendering error. meshscatter!() ended up doing the trick. Renders extremely slowly

Can you open an issue with more details? There’s a good chance that you’re doing something wrong or that you’re running into a regression, if something is very slow;)