# Makie: align y axes at the origin (y=0) for different y ranges

**URL:** <https://discourse.julialang.org/t/makie-align-y-axes-at-the-origin-y-0-for-different-y-ranges/105282>\
**Category:** Visualization\
**Tags:** question, makie\
**Created:** [October 22, 2023, 3:34pm UTC](https://discourse.julialang.org/t/makie-align-y-axes-at-the-origin-y-0-for-different-y-ranges/105282 "2023-10-22T15:34:45Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![ryofurue](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ryofurue/32/24531_2.png) [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Post date:** [October 23, 2023, 1:47am UTC](https://discourse.julialang.org/t/makie-align-y-axes-at-the-origin-y-0-for-different-y-ranges/105282/5 "2023-10-23T01:47:21Z")

</div>

> [@jules](#):
>
> You can get the current limits with `ax.finallimits[]`

Thanks! I wanted to hear something like that.

Okay, I have to set the limits manually, but I’d like to utilize the “machinery” that Makie already has, as much as possible.

I’ve found another thread in this forum (see the link at the bottom) and am exploring the idea:

```julia
using CairoMakie
xs = 0:(pi/16):pi
co = cos.(xs)
fig = Figure()
ax = Axis(fig[1,1])
lines!(ax, xs, co)
rect = ax.finallimits[]
yorg = rect.origin[2]
ywid = rect.widths[2]
ytop = # use yorg and ywid 
ybot = # use yorg and ywid
ylims!(ax, ybot, ytop)

```

But, what are these values? `rect.widths[2]` turns out to be 10 . . .

* * *

> [@Makie - how to set only lower or upper axis limit?](https://discourse.julialang.org/t/makie-how-to-set-only-lower-or-upper-axis-limit/58320/2):
>
> I would have to add that scenario specifically, I guess I could go with ((nothing, lim), nothing) for setting the upper x limit, for example. What is the scenario in which you want to do this, so I understand it better. Are you adding plots but don’t want zero to shift? Also, ax.finallimits is what contains the actual current limits

---

_[View the full topic](https://discourse.julialang.org/t/makie-align-y-axes-at-the-origin-y-0-for-different-y-ranges/105282)._
