# Inserting margins above plot title

**URL:** <https://discourse.julialang.org/t/inserting-margins-above-plot-title/82801>\
**Category:** Visualization\
**Tags:** question, plotting, plots\
**Created:** [June 15, 2022, 9:57am UTC](https://discourse.julialang.org/t/inserting-margins-above-plot-title/82801 "2022-06-15T09:57:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![neuro\_enthusiast](https://avatars.discourse-cdn.com/v4/letter/n/43a26b/32.png) [@neuro\_enthusiast](https://discourse.julialang.org/u/neuro_enthusiast)\
**Post date:** [June 15, 2022, 9:57am UTC](https://discourse.julialang.org/t/inserting-margins-above-plot-title/82801/1 "2022-06-15T09:57:47Z")

</div>

Hi all! I’m trying to insert margin above the plot title but am unsure how. Any help would be great!

For context, I have been using Plots.jl and Measures.jl to insert margins but top\_margin only inserted space between the plot and the title.

ex.

```julia
using Plots, Measures
x = [1,2,3,4,5]
y = [1,2,3,4,5]
plot(x,y,title= "a random plot", top_margin=5mm)

```

---

<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:** [June 15, 2022, 11:15am UTC](https://discourse.julialang.org/t/inserting-margins-above-plot-title/82801/2 "2022-06-15T11:15:28Z")

</div>

A simple way is to insert carriage returns `\n` in the title string:

```julia
plot(x,y,title= "\n\nA random plot", topmargin=5mm)

```

But you can achieve finer control with plots’ layouts, if needed.

---

<div class="post-metadata">

**Author:** ![neuro\_enthusiast](https://avatars.discourse-cdn.com/v4/letter/n/43a26b/32.png) [@neuro\_enthusiast](https://discourse.julialang.org/u/neuro_enthusiast)\
**Post date:** [June 16, 2022, 3:54am UTC](https://discourse.julialang.org/t/inserting-margins-above-plot-title/82801/3 "2022-06-16T03:54:19Z")

</div>

Interesting solution, much thanks!
