Makie limits in a 3D scene

Hello,
two questions. I found that if I define the following limits for an LScene, let’s say something like

surface(-1:0.1:1, -1:0.1:1, 2*rand(21,21) .-1, limits = FRect((-1,-1,-1), (2,2,2)))
I can get limits for x,y,z from -1 to 1 for each one of them. So, why the minus ones? the 2’s seem to be the total length in each direction, right?

And second, let’s say I want to include the limits later, how do I do that for a given axis. The following outputs an error.

fig = Figure()
ax = LScene(fig)
surface!(ax, -1:0.1:1, -1:0.1:1, 2*rand(21,21) .-1)
limits!(ax,  FRect((-1,-1,-1), (2,2,2)) )

It’s FRect(origin, widths) if that’s your question. That goes for all types of rects as far as I’m aware.

Regarding your second question - a lot of the 3D stuff hasn’t been forwarded correctly yet. If something doesn’t work it’s a good idea to try the same with ax.scene instead.

Might also be update_limits!(scene, limits) instead

1 Like

Thanks,
first question. Yes that it is what I was looking for.
Second, nope. None of the above worked. Although, I found that the limits live in the old axis

axis = ax.scene[OldAxis]
axis[:data_limits] = FRect((-2,-2,-2), (4,4,4))

but, it is not working, no error. The limits are not being updated.

There used to be a problem replacing Automatic(), maybe that’s still a thing… Try setting limits in the LScene and updating them later. If that fails you could also just make those limits a node.

limits = Node(Rect(vec3f0(-1), Vec3f0(2)))
axis = LScene(..., scenekw=(limit=limits, ))
...
limits[] = new_limits
2 Likes

Try setting limits in the LScene and updating them later.

I tried that already, and it also fails.

you could also just make those limits a node.

Oh yes, Nodes, that will work. Thanks!