# Change Location of Label in Plots + The xtick axis are not showing fully

**URL:** https://discourse.julialang.org/t/change-location-of-label-in-plots-the-xtick-axis-are-not-showing-fully/83689
**Category:** General Usage
**Tags:** plots
**Created:** [July 3, 2022, 7:35am UTC](https://discourse.julialang.org/t/change-location-of-label-in-plots-the-xtick-axis-are-not-showing-fully/83689 "2022-07-03T07:35:21Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)
#### Post date: [July 3, 2022, 7:35am UTC](https://discourse.julialang.org/t/change-location-of-label-in-plots-the-xtick-axis-are-not-showing-fully/83689/1 "2022-07-03T07:35:21Z")

</div>

Hi all,

I am plotting sine waves, but there are problems:

1. xtick shows half the number of denominator, e.g. 5 \pi / 4 (the 4 is barely seen)
2. The label placement can it be moved above or at the bottom of the whole graph? so we can see the sine waves clearly.

This is the code:

```julia

using Plots, LaTeXStrings
gr(fmt=:svg)

f(x) = sin.(5*x + 30)
g(x) = sin.(5*x + 60)
h(x) = sin.(5*x + 135)
#plot([f g]; labels=["sin" "cos"], color=["red" "black"])

function pitick(start, stop, denom; mode=:text)
    a = Int(cld(start, π/denom))
    b = Int(fld(stop, π/denom))
    tick = range(a*π/denom, b*π/denom; step=π/denom)
    ticklabel = piticklabel.((a:b) .// denom, Val(mode))
    tick, ticklabel
end

function piticklabel(x::Rational, ::Val{:text})
    iszero(x) && return "0"
    S = x < 0 ? "-" : ""
    n, d = abs(numerator(x)), denominator(x)
    N = n == 1 ? "" : repr(n)
    d == 1 && return S * N * "π"
    S * N * "π/" * repr(d)
end

function piticklabel(x::Rational, ::Val{:latex})
    iszero(x) && return L"0"
    S = x < 0 ? "-" : ""
    n, d = abs(numerator(x)), denominator(x)
    N = n == 1 ? "" : repr(n)
    d == 1 && return L"%$S%$N\pi"
    L"%$S\frac{%$N\pi}{%$d}"
end

a, b = -2π, 2π
#plot(sin, a, b; xtick=pitick(a, b, 4), label="y = sin t", size=(720, 250))
#plot(cos, a, b; xtick=pitick(a, b, 4), label="y = cos t", size=(720, 250))

plot(f, a, b; xtick=pitick(a, b, 4; mode=:latex), label=L"y = \sin{\omega t + 30}", size=(720, 250), tickfontsize=10)
plot!(g, a, b; xtick=pitick(a, b, 4; mode=:latex), label=L"y = \sin{\omega t + 60}", size=(720, 250), tickfontsize=10)
plot!(h, a, b; xtick=pitick(a, b, 4; mode=:latex), label=L"y = \sin{\omega t + 135}", size=(720, 250), tickfontsize=10)

```

 ![Capture d’écran_2022-07-03_14-31-49](https://global.discourse-cdn.com/julialang/original/3X/f/7/f78a618b6acd7bf3ef4b62a48a607bc69d963e18.png)

Thank You

---

<div class="post-metadata">

### Author: ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)
#### Post date: [July 3, 2022, 2:13pm UTC](https://discourse.julialang.org/t/change-location-of-label-in-plots-the-xtick-axis-are-not-showing-fully/83689/2 "2022-07-03T14:13:06Z")

</div>

You probably want `bottom_margin=10Plots.mm` and `legend=:outertopright`
