Parametric surface plots with Makie

I am a new user of Makie.

How can I make a parametric plot of a surface in 3-dimensions with Makie?

For example, I am looking for something like this: ParametricPlot3D—Wolfram Language Documentation

Is there a similar functionality in Makie?

1 Like

Currently, you can do it as in these examples:

1 Like

Ah so the trick is to pass x, y, z as Matrices instead of Vectors?

If you convert the coordinates to vectors, it doesn’t work:

julia> let
           t = 0:0.1:15
           u = -1:0.1:1
           x = [u*sin(t) for t in t, u in u]
           y = [u*cos(t) for t in t, u in u]
           z = [t/4      for t in t, u in u]
           fig, _ = surface(vec(x), vec(y), vec(z), colorrange = (-2,-1.1), highclip = :orangered, lightposition = Vec3f0(0, 0, 0), ambient = Vec3f0(0.65, 0.65, 0.65), backlight = 5f0) # the colorrange must be outside the range of z
           wireframe!(x,y,z, overdraw = false, linewidth = 0.1) # try overdraw = true
ERROR: Found duplicate x/y coordinates: Dict((0.0, 0.0) => 48, (-0.0, -0.0) => 31, (-0.0, 0.0) => 31, (0.0, -0.0) => 41)

I don’t see this discussed in the docs: surface.

Can someone explain the logic here?

Not sure I understand. The example you were copying from is a surface on an irregular grid, so it needs x and y to be matrices. Not sure how you could recreate the image from that example using vectors. If you want a surface on an ordinary rectangular grid then you can pass in x and y as vectors. This is stated in the docs that you linked. Maybe I am missing the point though?

What does “irregular” mean in this context?

So I’m far from an expert here. But my understanding is that by regular grid they mean that the view from above would be a, rectangle where the vectors of x and y values give you the 2d points on that rectangle and Z is the height. Whereas an irregular grid can take any shape, e.g. you can set the bottom lefts of the 3 matrices X, Y and Z to be in the same location as the top right.