# Makie limits in a 3D scene

**URL:** https://discourse.julialang.org/t/makie-limits-in-a-3d-scene/56099
**Category:** Visualization
**Tags:** question, package, plotting, makie
**Created:** [February 26, 2021, 4:05pm UTC](https://discourse.julialang.org/t/makie-limits-in-a-3d-scene/56099 "2021-02-26T16:05:02Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![lazarusA](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lazarusa/32/6571_2.png) [@lazarusA](https://discourse.julialang.org/u/lazarusA)
#### Post date: [February 26, 2021, 4:05pm UTC](https://discourse.julialang.org/t/makie-limits-in-a-3d-scene/56099/1 "2021-02-26T16:05:02Z")

</div>

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.

```julia
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)) )

```

---

<div class="post-metadata">

### Author: ![ffreyer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ffreyer/32/21569_2.png) [@ffreyer](https://discourse.julialang.org/u/ffreyer)
#### Post date: [February 26, 2021, 4:59pm UTC](https://discourse.julialang.org/t/makie-limits-in-a-3d-scene/56099/2 "2021-02-26T16:59:44Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ffreyer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ffreyer/32/21569_2.png) [@ffreyer](https://discourse.julialang.org/u/ffreyer)
#### Post date: [February 26, 2021, 5:05pm UTC](https://discourse.julialang.org/t/makie-limits-in-a-3d-scene/56099/3 "2021-02-26T17:05:26Z")

</div>

Might also be `update_limits!(scene, limits)` instead

---

<div class="post-metadata">

### Author: ![lazarusA](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lazarusa/32/6571_2.png) [@lazarusA](https://discourse.julialang.org/u/lazarusA)
#### Post date: [February 26, 2021, 5:12pm UTC](https://discourse.julialang.org/t/makie-limits-in-a-3d-scene/56099/4 "2021-02-26T17:12:17Z")

</div>

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

```julia
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.

---

<div class="post-metadata">

### Author: ![ffreyer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ffreyer/32/21569_2.png) [@ffreyer](https://discourse.julialang.org/u/ffreyer)
#### Post date: [February 26, 2021, 5:19pm UTC](https://discourse.julialang.org/t/makie-limits-in-a-3d-scene/56099/5 "2021-02-26T17:19:34Z")

</div>

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.

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

```

---

<div class="post-metadata">

### Author: ![lazarusA](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lazarusa/32/6571_2.png) [@lazarusA](https://discourse.julialang.org/u/lazarusA)
#### Post date: [February 26, 2021, 5:24pm UTC](https://discourse.julialang.org/t/makie-limits-in-a-3d-scene/56099/6 "2021-02-26T17:24:50Z")

</div>

> 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!
