# Plots - how to add padding between subplots

**URL:** <https://discourse.julialang.org/t/plots-how-to-add-padding-between-subplots/21037>\
**Category:** General Usage\
**Tags:** plotting\
**Created:** [February 21, 2019, 7:00am UTC](https://discourse.julialang.org/t/plots-how-to-add-padding-between-subplots/21037 "2019-02-21T07:00:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tk3369](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tk3369/32/2824_2.png) [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Post date:** [February 21, 2019, 7:00am UTC](https://discourse.julialang.org/t/plots-how-to-add-padding-between-subplots/21037/1 "2019-02-21T07:00:57Z")

</div>

The obvious choice is to specify `margin` attribute but it actually controls the margin space around the subplots _but not including_ the labels. That means a wider margin would make the labels farther apart from the graph. Is there any way to keep the labels close to the subplots but instead control the margin between the subplots? (My definition of subplot includes the labels, too.)

MWE:

```julia
histogram(randn(1000,4), layout = 4,xlims=(-4,4),leg=false,
        xaxis = "Values",yaxis = "Density", margin = 20px)

```

---

<div class="post-metadata">

**Author:** ![davide](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davide/32/52136_2.png) [@davide](https://discourse.julialang.org/u/davide)\
**Post date:** [March 11, 2019, 2:39pm UTC](https://discourse.julialang.org/t/plots-how-to-add-padding-between-subplots/21037/2 "2019-03-11T14:39:53Z")

</div>

I am having the same problem. The work around I am using is to add “\n” to the labels (e.g. xlab=“Label\n”) and then setting the margins to accommodate for that (e.g. bottom\_margin=20px).  
Eg.

```julia
p1 = plot(x,y1, xlab="Some label\n");
p2 = plot(x,y2 xlab="Some label\n");
plot(p1, p2, bottom_margin=20px)

```

Not the best solution (and it does not work with LaTeXStrings), but I could not find anything else in the docs.
