# Controlling gaps between Axis3 areas in Makie

**URL:** <https://discourse.julialang.org/t/controlling-gaps-between-axis3-areas-in-makie/95643>\
**Category:** Visualization\
**Tags:** makie\
**Created:** [March 7, 2023, 1:33am UTC](https://discourse.julialang.org/t/controlling-gaps-between-axis3-areas-in-makie/95643 "2023-03-07T01:33:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wsshin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wsshin/32/360_2.png) [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Post date:** [March 7, 2023, 1:33am UTC](https://discourse.julialang.org/t/controlling-gaps-between-axis3-areas-in-makie/95643/1 "2023-03-07T01:33:32Z")

</div>

I am trying to show xy-, xz-, yz-views of a 3D object using Makie. Here is the code to set up three panels for the views:

```julia
using CairoMakie
fig = Figure(resolution=(1500,1500))
fig[1,1] = Axis3(fig, aspect=:data, viewmode=:fit, elevation=π/2, azimuth=-π/2)
fig[2,1] = Axis3(fig, aspect=:data, viewmode=:fit, elevation=0.0, azimuth=-π/2)
fig[2,2] = Axis3(fig, aspect=:data, viewmode=:fit, elevation=0.0, azimuth=0.0)
Box(fig[1,1], color=:transparent, strokecolor=:red)
Box(fig[2,1], color=:transparent, strokecolor=:red)
Box(fig[2,2], color=:transparent, strokecolor=:red)
resize_to_layout!(fig)
display(fig)

```

And here is the result:

 ![result](https://global.discourse-cdn.com/julialang/original/3X/3/b/3b9eccbed0728182c132098f6764ac4e6b4b438d.png)  
I would like to reduce the gap between the `Axis3` areas. I have two issues: the gaps between the black x-, y-, z-axes and the enclosing red rectangles are too wide, and the gaps between red rectangles are two wide. How can I reduce these gaps? I tried to change all the keyword arguments of `Axis3` whose names include pad, gap, margin, but none of them works.

---

<div class="post-metadata">

**Author:** ![asinghvi17](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/asinghvi17/32/8272_2.png) [@asinghvi17](https://discourse.julialang.org/u/asinghvi17)\
**Post date:** [March 7, 2023, 4:20am UTC](https://discourse.julialang.org/t/controlling-gaps-between-axis3-areas-in-makie/95643/2 "2023-03-07T04:20:21Z")

</div>

For the gaps between rectangles, you can set `colgap!(fig.layout, 0)` and `rowgap!(fig.layout, 0)`. As for the protrusions which cause the red boxes to be as large as they are, I’m not sure what you could do there.

You might also try setting `viewmode = :fitzoom` instead of `:fit`?

---

<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:** [March 7, 2023, 6:26am UTC](https://discourse.julialang.org/t/controlling-gaps-between-axis3-areas-in-makie/95643/3 "2023-03-07T06:26:17Z")

</div>

You can use Axis for the 2D view, and `rotate!` the objects such that the side you want faces forward. Axis3 doesn’t look good when it’s rotated like that, although I guess you could hide the extraneous axis elements. Axis3 has a `protrusions` attribute which you have to change manually to improve the gaps. It’s currently not done automatically because the correct values would change with the rotation of the axis.
