# How to increase the padding between xticks and xtick labels?

**URL:** <https://discourse.julialang.org/t/how-to-increase-the-padding-between-xticks-and-xtick-labels/88675>\
**Category:** Visualization\
**Tags:** plots, gr\
**Created:** [October 13, 2022, 4:05pm UTC](https://discourse.julialang.org/t/how-to-increase-the-padding-between-xticks-and-xtick-labels/88675 "2022-10-13T16:05:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gregstrq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gregstrq/32/20620_2.png) [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Post date:** [October 13, 2022, 4:05pm UTC](https://discourse.julialang.org/t/how-to-increase-the-padding-between-xticks-and-xtick-labels/88675/1 "2022-10-13T16:05:12Z")

</div>

I have a problem, that xticks and xtick labels almost overlap if the ticks face outwards. (It is probably because my xtick labels are like \frac{\pi k}{N}).

![eigenmodes-func](https://global.discourse-cdn.com/julialang/original/3X/b/f/bfa98e72fb1b5b951e026b7762928724d316eb08.png)

How do I increase the padding between the xticks and xtick labels?  
I am using Plots with GR backend.

---

<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:** [October 13, 2022, 7:16pm UTC](https://discourse.julialang.org/t/how-to-increase-the-padding-between-xticks-and-xtick-labels/88675/2 "2022-10-13T19:16:30Z")

</div>

Prepending a carriage return to the `xlabel` argument string, leaves a blank line in-between the ticks and the label.

For example, `xlabel="\nX axis"` produces:

 ![Plots_gr_xlabels_offset_carriage_return](https://global.discourse-cdn.com/julialang/original/3X/d/b/dbd26a945668c13ba275f2db63da198c9c7c8a8b.png)

---

<div class="post-metadata">

**Author:** ![de-souza](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/de-souza/32/43417_2.png) [@de-souza](https://discourse.julialang.org/u/de-souza)\
**Post date:** [October 13, 2022, 7:25pm UTC](https://discourse.julialang.org/t/how-to-increase-the-padding-between-xticks-and-xtick-labels/88675/3 "2022-10-13T19:25:32Z")

</div>

In Makie, the [xticklabelpad Axis attribute](https://docs.makie.org/v0.18.0/api/index.html#Axis) controls the space between xticks and xticklabels. Not sure how to do it with Plots with the GR backend 😕

---

<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:** [October 13, 2022, 8:38pm UTC](https://discourse.julialang.org/t/how-to-increase-the-padding-between-xticks-and-xtick-labels/88675/4 "2022-10-13T20:38:26Z")

</div>

For finer control of the spacing, we can first plot an empty line label with plots() keyword argument `xlabel="\n"` and then annotate outside the plot using the plot units:

```julia
annotate!([π/2],[-0.2], text("X axis", 11, "Computer Modern"))

```

to get:

 ![Plots_gr_xlabels_annotated](https://global.discourse-cdn.com/julialang/original/3X/6/c/6cfbaf1200695cc486f20a56cd16f4957f4af73b.png)
