# Makie inset fully "on top"

**URL:** <https://discourse.julialang.org/t/makie-inset-fully-on-top/124492>\
**Category:** Visualization\
**Tags:** makie\
**Created:** [January 7, 2025, 9:24am UTC](https://discourse.julialang.org/t/makie-inset-fully-on-top/124492 "2025-01-07T09:24:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gvdeynde](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gvdeynde/32/50975_2.png) [@gvdeynde](https://discourse.julialang.org/u/gvdeynde)\
**Post date:** [January 7, 2025, 9:24am UTC](https://discourse.julialang.org/t/makie-inset-fully-on-top/124492/1 "2025-01-07T09:24:07Z")

</div>

Similar to [this question](https://discourse.julialang.org/t/inset-axis-with-non-transparent-background/86763). I’m drawing a figure that has a main axis and an inset (a zoom). How would I go about to have the whole inset with a background, effectively blocking out the underlying main figure?

Using a gray background in the `Axis` for the inset and using `translate!(inset.blockscene, 0, 0, 100)` gives me the figure below. The grid lines of the main plot are indeed blocked by the gray background of the inset `Axis`. However, I would also like to have the ticks and labels of the inset `Axis` with the same grey background and also blocking out the underlying graph (lines and gridlines).

 ![image](https://global.discourse-cdn.com/julialang/original/3X/8/b/8bf4ece77ac94a22883dfff7d2c210ef96636188.png)

---

<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:** [January 7, 2025, 11:44am UTC](https://discourse.julialang.org/t/makie-inset-fully-on-top/124492/2 "2025-01-07T11:44:15Z")

</div>

```julia
f = Figure()
Axis(f[1, 1])
scatter!(cumsum(randn(1000)))

inset_gl = GridLayout(f[1, 1], height = Relative(0.5), width = Relative(0.5))
b = Box(inset_gl[1, 1], color = :gray80)
translate!(b.blockscene, 0, 0, 100)
inset = Axis(inset_gl[1, 1], alignmode = Outside(15))
translate!(inset.blockscene, 0, 0, 200)
f

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/f/9/f9ae3bd92e8feff99e6ad1c6e56b53fa592b15d5.png)

---

<div class="post-metadata">

**Author:** ![gvdeynde](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gvdeynde/32/50975_2.png) [@gvdeynde](https://discourse.julialang.org/u/gvdeynde)\
**Post date:** [January 7, 2025, 1:04pm UTC](https://discourse.julialang.org/t/makie-inset-fully-on-top/124492/3 "2025-01-07T13:04:31Z")

</div>

Thanks! But for the next level, what if my inset has a double y-axis?

I’m seeing this when I add a second vertical axis using the information on [creating a twin axis](https://docs.makie.org/stable/reference/blocks/axis#Creating-a-twin-axis). It seems the second Axis is shifted left and down.

Code snippet

```julia

<your code>
      inset2 = Axis(inset_gl[1, 1],
        limits=(tz1, tz2, v2low, v2high),
        ylabel=v2label,
        yticks=LinearTicks(v2zoomticks),
        ytickformat="{:.$(v2digits)f}",
        yaxisposition=:right,
        alignmode=Outside(15),
      )

      hidespines!(inset2)
      hidexdecorations!(inset2)

      lines!(inset2, t, v2)

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/0/4/047947e7f94f3a56d52d2b2c5d5dfb46164f6c08.png)
