# Makie xlims!

**URL:** <https://discourse.julialang.org/t/makie-xlims/56417>\
**Category:** General Usage\
**Created:** [March 3, 2021, 4:12pm UTC](https://discourse.julialang.org/t/makie-xlims/56417 "2021-03-03T16:12:23Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mschauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mschauer/32/13946_2.png) [@mschauer](https://discourse.julialang.org/u/mschauer)\
**Post date:** [March 3, 2021, 4:12pm UTC](https://discourse.julialang.org/t/makie-xlims/56417/1 "2021-03-03T16:12:24Z")

</div>

How do I make this work… I have essentially tried everything for the last twenty minutes

```julia
?? = lines(x, y, z, linewidth=0.5, show_axis=false)
xlims!(??, 1.05,1.95)
ylims!(??, 1.05,1.95)

```

---

<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:** [March 3, 2021, 4:15pm UTC](https://discourse.julialang.org/t/makie-xlims/56417/2 "2021-03-03T16:15:37Z")

</div>

😃 I did have the same problem the other day.  
A solution here:

[Makie limits in a 3D scene - Domains / Visualization - JuliaLang](https://discourse.julialang.org/t/makie-limits-in-a-3d-scene/56099/4)

Although, I don’t like this approach. I think it will be better to be able to define the `x,y,z limits` instead of the axis from `origin` to `width`.

---

<div class="post-metadata">

**Author:** ![darsnack](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/darsnack/32/10144_2.png) [@darsnack](https://discourse.julialang.org/u/darsnack)\
**Post date:** [March 3, 2021, 4:40pm UTC](https://discourse.julialang.org/t/makie-xlims/56417/3 "2021-03-03T16:40:29Z")

</div>

```julia
fig = lines(x, y, z, linewidth=0.5, show_axis=false)
xlims!(fig.axis.scene, 1.05,1.95)
ylims!(fig.axis.scene, 1.05,1.95)

```

Seems like an oversight bug that `fig.axis` which is a `LScene` doesn’t work with the limit functions. So, we need to get the underlying plain old Makie `Scene`.

If you are planning on doing layouts though, it might be better to use an explicit axis:

```julia
fig = Figure()
ax1 = fig[1, 1] = Axis(fig, ...)
lines!(ax1, x, y, z, linewidth=0.5, show_axis=false)
xlims!(ax1, 1.05, 1.95)
ylims!(ax1, 1.05, 1.95)

```

---

<div class="post-metadata">

**Author:** ![mschauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mschauer/32/13946_2.png) [@mschauer](https://discourse.julialang.org/u/mschauer)\
**Post date:** [March 3, 2021, 4:42pm UTC](https://discourse.julialang.org/t/makie-xlims/56417/4 "2021-03-03T16:42:37Z")

</div>

> [@darsnack](#):
>
> `fig.axis` […] doesn’t work with the limit functions.

Yes, that confused and frustrated me

---

<div class="post-metadata">

**Author:** ![darsnack](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/darsnack/32/10144_2.png) [@darsnack](https://discourse.julialang.org/u/darsnack)\
**Post date:** [March 3, 2021, 4:52pm UTC](https://discourse.julialang.org/t/makie-xlims/56417/5 "2021-03-03T16:52:06Z")

</div>

😀  
[https://github.com/JuliaPlots/Makie.jl/issues/862](https://github.com/JuliaPlots/Makie.jl/issues/862)

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [March 4, 2021, 6:56am UTC](https://discourse.julialang.org/t/makie-xlims/56417/6 "2021-03-04T06:56:25Z")

</div>

I think the problem is that LScene is not a 3D axis per se, we just currently use it as a workaround to have the old 3D plots available in layouts. As I showed on Slack, I think we need a reworked 3D axis anyway to make the look more streamlined with the 2D version. The key part here is to understand LScene is just a “dumb” layout wrapper for Scene, which is the real thing you need to manipulate. Axis on the other hand never has you modify the underlying Scene yourself. That’s the reason why LScene doesn’t have the helper functions defined

---

<div class="post-metadata">

**Author:** ![jlchan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlchan/32/10958_2.png) [@jlchan](https://discourse.julialang.org/u/jlchan)\
**Post date:** [June 2, 2021, 3:39am UTC](https://discourse.julialang.org/t/makie-xlims/56417/7 "2021-06-02T03:39:57Z")

</div>

I don’t think this got answered in this thread - is there currently a workaround way to set limits for an LScene?

---

<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:** [September 21, 2022, 8:20pm UTC](https://discourse.julialang.org/t/makie-xlims/56417/8 "2022-09-21T20:20:42Z")

</div>

just follow something like in [here](https://github.com/MakieOrg/Makie.jl/issues/1789):

```nohighlight
f = Figure()
l = LScene(f[1, 1], scenekw = (; limits=Rect3f(Vec3f(0,0,0),Vec3f(1.5, 1.5, 2.5))))
meshscatter!(l, rand(Point3f, 10); color = :blue)
meshscatter!(l, rand(Point3f, 10); color = :red)
f

```
