# How can I move the x axis and ticks at top of the graph?

**URL:** https://discourse.julialang.org/t/how-can-i-move-the-x-axis-and-ticks-at-top-of-the-graph/101479
**Category:** Visualization
**Tags:** visualization, plots, gr
**Created:** [July 11, 2023, 11:51am UTC](https://discourse.julialang.org/t/how-can-i-move-the-x-axis-and-ticks-at-top-of-the-graph/101479 "2023-07-11T11:51:08Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![bertulli](https://avatars.discourse-cdn.com/v4/letter/b/ecc23a/32.png) [@bertulli](https://discourse.julialang.org/u/bertulli)
#### Post date: [July 11, 2023, 11:51am UTC](https://discourse.julialang.org/t/how-can-i-move-the-x-axis-and-ticks-at-top-of-the-graph/101479/1 "2023-07-11T11:51:09Z")

</div>

Hi all! I’m trying to plot a heatmap of a distance matrix:

```julia
julia> distance_matrix_measures
12×12 Matrix{Float64}:
 0.0 0.0242429 0.0217801 … 0.0443951 0.0124709 0.0114215
 0.0242429 0.0 0.00246275 0.068638 0.0117719 0.0128213
 0.0217801 0.00246275 0.0 0.0661752 0.00930917 0.0103586
 0.0460765 0.0703193 0.0678566 0.00168135 0.0585474 0.057498
 0.00384102 0.0204018 0.0179391 0.0482362 0.00862992 0.00758049
 0.00412733 0.0201155 0.0176528 … 0.0485225 0.00834362 0.00729419
 0.00651857 0.0307614 0.0282987 0.0378766 0.0189895 0.0179401
 0.0316369 0.00739405 0.00985679 0.076032 0.019166 0.0202154
 0.0270464 0.00280358 0.00526632 0.0714416 0.0145755 0.0156249
 0.0443951 0.068638 0.0661752 0.0 0.0568661 0.0558166
 0.0124709 0.0117719 0.00930917 … 0.0568661 0.0 0.00104943
 0.0114215 0.0128213 0.0103586 0.0558166 0.00104943 0.0

julia> heatmap(
           [t.program for t in results],
           [t.program for t in results],
           distance_matrix_measures,
           c=cgrad([:green, :yellow, :red]),
           title="Differences between measured programs",
           aspect_ratio = :equal, yflip = true,
           xrotation = 90,
           #grid = false, axis= false, ticks = true
       )

```

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

Here’s the thing: since I reversed the y axis to have the plot consistent with how you’d write down numerically the matrix, I’d also like to **move the x axis at the top**. How can I do that? I’m on Plots.jl with GR backend.

Thanks!

---

<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: [July 11, 2023, 12:09pm UTC](https://discourse.julialang.org/t/how-can-i-move-the-x-axis-and-ticks-at-top-of-the-graph/101479/2 "2023-07-11T12:09:15Z")

</div>

Check the keyword `xmirror=true`

---

<div class="post-metadata">

### Author: ![bertulli](https://avatars.discourse-cdn.com/v4/letter/b/ecc23a/32.png) [@bertulli](https://discourse.julialang.org/u/bertulli)
#### Post date: [July 11, 2023, 3:45pm UTC](https://discourse.julialang.org/t/how-can-i-move-the-x-axis-and-ticks-at-top-of-the-graph/101479/3 "2023-07-11T15:45:04Z")

</div>

Thanks!
