# Inset axis in Makie

**URL:** <https://discourse.julialang.org/t/inset-axis-in-makie/70209>\
**Category:** Visualization\
**Tags:** makie\
**Created:** [October 22, 2021, 12:36pm UTC](https://discourse.julialang.org/t/inset-axis-in-makie/70209 "2021-10-22T12:36:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Post date:** [October 22, 2021, 12:36pm UTC](https://discourse.julialang.org/t/inset-axis-in-makie/70209/1 "2021-10-22T12:36:04Z")

</div>

How to make the inset axis non-transparent?

```julia
using CairoMakie
f = Figure()
ax1 = Axis(f[1,1])
scatter!(ax1, randn(1000), randn(1000))
ax2 = Axis(f[1,1], width=Relative(0.2), height=Relative(0.3), halign=0.1, valign=0.1, backgroundcolor=:white)
scatter!(ax2, randn(100), randn(100), color=:red)
save("test.png", f)
f

```

 ![test](https://global.discourse-cdn.com/julialang/original/3X/1/6/16af640beec936f5f5697f11f4ba64eefa7a45b9.png)

---

<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:** [October 22, 2021, 12:53pm UTC](https://discourse.julialang.org/t/inset-axis-in-makie/70209/2 "2021-10-22T12:53:24Z")

</div>

I usually do:

```julia
# bring content upfront
    translate!(ax2.scene, 0, 0, 10)
    elements = keys(ax2.elements)
    filtered = filter(ele -> ele != :xaxis && ele != :yaxis, elements)
    foreach(ele -> translate!(ax2.elements[ele], 0, 0, 9), filtered)

```

[Layouts - Julia Data Science](https://juliadatascience.io/makie_layouts) (last section)

---

<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:** [October 22, 2021, 1:59pm UTC](https://discourse.julialang.org/t/inset-axis-in-makie/70209/3 "2021-10-22T13:59:39Z")

</div>

This will probably get much easier relatively soon, when every object like Axis etc will have its own container scene which needs just one z translation forward. Or I make a convenience method for inset axes anyway.

---

<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:** [October 22, 2021, 3:10pm UTC](https://discourse.julialang.org/t/inset-axis-in-makie/70209/4 "2021-10-22T15:10:46Z")

</div>

@jules Do you have a branch already available… I would be interested in taking a look 😃

---

<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:** [October 22, 2021, 4:45pm UTC](https://discourse.julialang.org/t/inset-axis-in-makie/70209/5 "2021-10-22T16:45:06Z")

</div>

Yeah it’s this one [https://github.com/JuliaPlots/Makie.jl/tree/jk/layoutables-refactor](https://github.com/JuliaPlots/Makie.jl/tree/jk/layoutables-refactor)

Only Axis, Slider, Label and the new SliderGrid work so far (that one is a consolidation of what `labelslidergrid!` did before). It’s the `ax.blockscene` field that contains the `Scene` that you need to translate forward.
