# Plots.jl equivalent to Matlab's "axis padded"?

**URL:** <https://discourse.julialang.org/t/plots-jl-equivalent-to-matlabs-axis-padded/71219>\
**Category:** New to Julia\
**Tags:** plotting, plots\
**Created:** [November 9, 2021, 7:48pm UTC](https://discourse.julialang.org/t/plots-jl-equivalent-to-matlabs-axis-padded/71219 "2021-11-09T19:48:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [November 9, 2021, 7:48pm UTC](https://discourse.julialang.org/t/plots-jl-equivalent-to-matlabs-axis-padded/71219/1 "2021-11-09T19:48:58Z")

</div>

Would anyone happen to have it, hopefully a one liner?

> **[Set axis limits and aspect ratios - MATLAB axis
- MathWorks Nordic](https://se.mathworks.com/help/matlab/ref/axis.html)**
>
> This MATLAB function specifies the limits for the current axes.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/8/c/8c0eb503fac97eac572545da30d7a8dea4643037.png)

What I want is that no plotted data is touching an edge and I want it done automatically, without having to think about it.

I am using Plots.jl

Kind regards

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [November 9, 2021, 7:54pm UTC](https://discourse.julialang.org/t/plots-jl-equivalent-to-matlabs-axis-padded/71219/2 "2021-11-09T19:54:51Z")

</div>

```julia
using Plots; gr()
x = 0:12
plot(x, sin, lt=:step, framestyle=:box, label=false)

```

_ **NB:** _  
_that is the default behaviour. In case a tight plot is required, add argument:_ `widen=false`

---

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [November 9, 2021, 8:10pm UTC](https://discourse.julialang.org/t/plots-jl-equivalent-to-matlabs-axis-padded/71219/3 "2021-11-09T20:10:41Z")

</div>

Thanks, that makes the plot I am making a bit better.

Still not completely what I want, since the box around it is not “square” but rectangular. Minor issue at this point though - thanks again!

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [November 9, 2021, 8:11pm UTC](https://discourse.julialang.org/t/plots-jl-equivalent-to-matlabs-axis-padded/71219/4 "2021-11-09T20:11:51Z")

</div>

You can add argument: `size=(600,600)`
