# Makie - how to set only lower or upper axis limit?

**URL:** https://discourse.julialang.org/t/makie-how-to-set-only-lower-or-upper-axis-limit/58320
**Category:** Visualization
**Tags:** question, makie
**Created:** [March 31, 2021, 5:50pm UTC](https://discourse.julialang.org/t/makie-how-to-set-only-lower-or-upper-axis-limit/58320 "2021-03-31T17:50:28Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Kolaru](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kolaru/32/4574_2.png) [@Kolaru](https://discourse.julialang.org/u/Kolaru)
#### Post date: [March 31, 2021, 5:50pm UTC](https://discourse.julialang.org/t/makie-how-to-set-only-lower-or-upper-axis-limit/58320/1 "2021-03-31T17:50:28Z")

</div>

When plotting Makie automatically set axis limits. I would like to keep the automatically generated upper limit while setting the lower one to zero. How could I do that?

At first I wanted to get the current limits and reset them, but `ax.limits` give me `(nothing, nothing)`.

---

<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 31, 2021, 6:26pm UTC](https://discourse.julialang.org/t/makie-how-to-set-only-lower-or-upper-axis-limit/58320/2 "2021-03-31T18:26:56Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Kolaru](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kolaru/32/4574_2.png) [@Kolaru](https://discourse.julialang.org/u/Kolaru)
#### Post date: [March 31, 2021, 7:10pm UTC](https://discourse.julialang.org/t/makie-how-to-set-only-lower-or-upper-axis-limit/58320/3 "2021-03-31T19:10:48Z")

</div>

I am plotting errors (always positive) for different methods. If the errors are all huge but one is like 1% smaller, having limits tight around the lines make it look like one method is much better than the other when really it is not. I want like the plot to start at 0 so that relative small difference or noise actually look small.

Using `ax.finallimits` I did the following

```julia
rect = ax.finallimits[]
topy = (rect.origin + rect.widths)[2]
ylims!(ax, -0.1*topy, topy)

```

which allows me to get what I want (okay I still need to move the legend)

 ![image](https://global.discourse-cdn.com/julialang/original/3X/4/9/4973b244c7a4c5b5fca464db1b26987b200a3831.png)

It could be made nicer in the API but it works for me as it is 🙂

---

<div class="post-metadata">

### Author: ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)
#### Post date: [January 24, 2023, 6:17pm UTC](https://discourse.julialang.org/t/makie-how-to-set-only-lower-or-upper-axis-limit/58320/4 "2023-01-24T18:17:48Z")

</div>

Sorry to revive an old topic. But was there a better way to do this added to the API in the end?

Similar to what you would do in pyplot, with `set_ylim(bottom=0)`, to set the lower limit to 0 but letting the upper limit to be inferred from the data.

---

<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: [January 24, 2023, 6:54pm UTC](https://discourse.julialang.org/t/makie-how-to-set-only-lower-or-upper-axis-limit/58320/5 "2023-01-24T18:54:41Z")

</div>

`ylims!(low = 1)` or `xlims(high = 5)` for example

[https://docs.makie.org/stable/examples/blocks/axis/index.html#setting\_half-automatic\_limits](https://docs.makie.org/stable/examples/blocks/axis/index.html#setting_half-automatic_limits)
