# Plots: margins, positions of axes, etc., within the canvas (paper)

**URL:** <https://discourse.julialang.org/t/plots-margins-positions-of-axes-etc-within-the-canvas-paper/100317>\
**Category:** Visualization\
**Tags:** question, plotting\
**Created:** [June 14, 2023, 8:31am UTC](https://discourse.julialang.org/t/plots-margins-positions-of-axes-etc-within-the-canvas-paper/100317 "2023-06-14T08:31:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryofurue](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ryofurue/32/24531_2.png) [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Post date:** [June 14, 2023, 8:31am UTC](https://discourse.julialang.org/t/plots-margins-positions-of-axes-etc-within-the-canvas-paper/100317/1 "2023-06-14T08:31:37Z")

</div>

What is the general method to control the positions of the axes in a plot?

Below is my first small attempt to push the upper x axis downward, which fails:

```julia
julia> using Plots

julia> plot(sin; top_margin=10mm)
ERROR: UndefVarError: `mm` not defined
Stacktrace:
 [1] top-level scope
   @ REPL[2]:1

julia> plotattr("top_margin")
Specifies the extra padding on the top of the subplot (`:match` matches `:margin`).

Aliases: (:top_margins, :topmargin, :topmargins).

Type: Union{Real, Symbol, Tuple}.

`Subplot` attribute, defaults to `match`.

julia>

```

My ultimate goal is to precisely control the end points of the axes within the “canvas” or “paper”.

For example, suppose that your final plot is a PDF image within a bounding box of (x\_left, y\_bottom, x\_right, y\_top) = (0, 0, 100mm, 80mm), and suppose that you want to place the four axes at x = 10mm and x = 90mm and y = 15mm and y = 70mm. What julia code would you write?

If it’s impossible to specify physical positions, what about relative, normalized positions? For example, suppose that your canvas is [0,1] x [0,1] and you want your axes at x = 0.1 and x = 0.9 and y = 0.1 and y = 0.7.

If it’s impossible to specify precise positions at all, what about moving the axes from their default positions?
