# How to exchange x-y axis and layout with another image?

**URL:** <https://discourse.julialang.org/t/how-to-exchange-x-y-axis-and-layout-with-another-image/67615>\
**Category:** Visualization\
**Tags:** plotting\
**Created:** [September 3, 2021, 2:02am UTC](https://discourse.julialang.org/t/how-to-exchange-x-y-axis-and-layout-with-another-image/67615 "2021-09-03T02:02:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![thudjx](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thudjx/32/15231_2.png) [@thudjx](https://discourse.julialang.org/u/thudjx)\
**Post date:** [September 3, 2021, 2:02am UTC](https://discourse.julialang.org/t/how-to-exchange-x-y-axis-and-layout-with-another-image/67615/1 "2021-09-03T02:02:05Z")

</div>

All I want to achieve is something like this:  
 ![Color-online-Band-structure-and-DOS-of-graphene](https://global.discourse-cdn.com/julialang/original/3X/1/d/1d2f4eec82da7f8e058d3582e50a1af70ad1acca.png)

1. the second plot should be drawn with x-y axes exchanged
2. y axis of the two plots should be overlayed  
Can anyone help me about this? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [September 3, 2021, 5:23pm UTC](https://discourse.julialang.org/t/how-to-exchange-x-y-axis-and-layout-with-another-image/67615/2 "2021-09-03T17:23:36Z")

</div>

In Makie (because you posted into the Slack channel as well) you would do the x-y change by just flipping the argument order of x and y.

Then you’d link the y limits with `linkyaxes!`.

The red lines are a bit more difficult, because you’d need to plot into the Figure scene and compute the end points given the axis projection. Is that also part of your requirements?

---

<div class="post-metadata">

**Author:** ![lazarusA](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lazarusa/32/6571_2.png) [@lazarusA](https://discourse.julialang.org/u/lazarusA)\
**Post date:** [September 3, 2021, 5:33pm UTC](https://discourse.julialang.org/t/how-to-exchange-x-y-axis-and-layout-with-another-image/67615/3 "2021-09-03T17:33:23Z")

</div>

@jules I always find hard to grasp that part about plotting into the Figure scene, maybe it will be good to have something in the Makie docs, with one example drawing some lines between two axis. Just a suggestion.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [September 3, 2021, 5:52pm UTC](https://discourse.julialang.org/t/how-to-exchange-x-y-axis-and-layout-with-another-image/67615/4 "2021-09-03T17:52:46Z")

</div>

Yeah it’s a good point. I think we should solidify an api around these axis / figure transformations because I still do them manually everytime.
