# How to increase gap between axis title and axis in PlotlyJS?

**URL:** <https://discourse.julialang.org/t/how-to-increase-gap-between-axis-title-and-axis-in-plotlyjs/61798>\
**Category:** General Usage\
**Tags:** plotting\
**Created:** [May 25, 2021, 5:32pm UTC](https://discourse.julialang.org/t/how-to-increase-gap-between-axis-title-and-axis-in-plotlyjs/61798 "2021-05-25T17:32:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oto\_Brzobohaty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oto_brzobohaty/32/10370_2.png) [@Oto\_Brzobohaty](https://discourse.julialang.org/u/Oto_Brzobohaty)\
**Post date:** [May 25, 2021, 5:32pm UTC](https://discourse.julialang.org/t/how-to-increase-gap-between-axis-title-and-axis-in-plotlyjs/61798/1 "2021-05-25T17:32:01Z")

</div>

Is there any parameter in PlotlyBase to set the gap between title of axis and axis.

Typically with log scaled axis my axis title (for y axis) is overlapping with “numbers”.

---

<div class="post-metadata">

**Author:** ![halleysfifthinc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/halleysfifthinc/32/206280_2.png) [@halleysfifthinc](https://discourse.julialang.org/u/halleysfifthinc)\
**Post date:** [May 25, 2021, 9:09pm UTC](https://discourse.julialang.org/t/how-to-increase-gap-between-axis-title-and-axis-in-plotlyjs/61798/2 "2021-05-25T21:09:16Z")

</div>

The Layout options that you want to play with are the [margins](https://plotly.com/javascript/reference/layout/#layout-margin), [`autoexpand`](https://plotly.com/javascript/reference/layout/#layout-margin-autoexpand), [`standoff`](https://plotly.com/javascript/reference/layout/xaxis/#layout-xaxis-title-standoff), and [`automargin`](https://plotly.com/javascript/reference/layout/xaxis/#layout-xaxis-automargin).

---

<div class="post-metadata">

**Author:** ![Oto\_Brzobohaty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oto_brzobohaty/32/10370_2.png) [@Oto\_Brzobohaty](https://discourse.julialang.org/u/Oto_Brzobohaty)\
**Post date:** [May 26, 2021, 6:07am UTC](https://discourse.julialang.org/t/how-to-increase-gap-between-axis-title-and-axis-in-plotlyjs/61798/3 "2021-05-26T06:07:08Z")

</div>

Thank you for the links.

I have tried

```julia
layout = Layout(; margin_l = 100, margin_pad = 100)

```

But there was no effect. Please, could you help me with some working example?

---

<div class="post-metadata">

**Author:** ![empet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/empet/32/221303_2.png) [@empet](https://discourse.julialang.org/u/empet)\
**Post date:** [May 26, 2021, 10:16am UTC](https://discourse.julialang.org/t/how-to-increase-gap-between-axis-title-and-axis-in-plotlyjs/61798/4 "2021-05-26T10:16:07Z")

</div>

To set some distance in pixels between xaxis ticklabels and xaxis title  
you have to set xaxis\_title\_standoff=12 #(12 or another value by trial and error).  
But the plotly docs say:

```julia
standoff
 | Sets the standoff distance (in px) between the axis
 | labels and the title text The default value is a
 | function of the axis tick labels, the title `font.size`
 | and the axis `linewidth`. Note that the axis title
 | position is always constrained within the margins, so
 | the actual standoff distance is always less than the
 | set or default value. By setting `standoff` and turning
 | on `automargin`, plotly.js will push the margins to fit
 | the axis title at given standoff distance.

```

Hence try settings like in this example:

```julia
using PlotlyJS

pl= plot(scatter(x=1:5, y=3*rand(5), line_color="RoyalBlue"), 
         Layout(width=600, height=400,
                xaxis_title_text="X-TITLE", xaxis_title_standoff=12, xaxis_automargin=true))

```
