3D plotting

Flippa's icon

Hi there,

Quick question, what is the easiest way to plot a 3D graph in Jitter? Say you have the values X,Y,Z and time and you want a 3D model of the data points? A link to a tutorial would be great.

Kind Regards

FlippA

seejayjames's icon

I'd use jit.gl.sketch with the "point $1 $2 $3" command for each point. point_size $1 to increase the size, use antialias 1 for round (not square) points. You can also use lineto $1 $2 $3 for a web-like plot, and line_width to set the thickness. Low alphas for the colors might help see more of the graph when points are covered.

When you say "X Y Z and time", I'm not really getting it, isn't that 4 dimensions? I would have thought that time would be on the Y axis (left-right when at default camera position), and your X and Z would vary, so it would look like a traditional XY plot, but with depth (use jit.gl.handle to rotate the scene around, to see the depth). What you're saying would be a full plot for each time instant (right?) so it would be morphing from frame to frame (4-D). So an overall X Y Z plot of points which changes over time instants, cool.

Either way, if you have the data (or are generating it with uzi and expr or something), you can definitely plot it with jit.gl.sketch, provided you scale it to your GL world appropriately. If you make a matrix out of your data points and feed it into the vertex inlet of a jit.gl.mesh, that would also work. The above way is a point-by-point plot and probably way slower, but that might not matter, and if you want you can control the drawing speed (with a delay) if that's good for visualization.

Stick in three jit.gl.gridshapes: planes, poly_mode 1 1, dim 10 10, rotated appropriately to X Y Z---that'll give you surfaces to orient yourself in the world, a lot more helpful than just the axes. Also use camera 0 0 $1 to zoom in and out (Z-direction). Then, with the scaling of your gridshapes, you can see the extent of what you're looking at, and scale your data points to fit...or not

Flippa's icon

Dear seejayjames,

Thank you for the great reply, I will get on trying your methods and see what I can come up with and hopefully make some nice looking data.

Many Thanks

FlippA