Created
March 27, 2025 13:18
-
-
Save jkrumbiegel/830e980bc0c67cc06e617db2918e19dc to your computer and use it in GitHub Desktop.
Stacked twin axis Makie
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f = Figure() | |
main_ax = Axis(f[1, 1]) | |
twin_ax_layout = GridLayout(f[1, 1, Right()]) | |
twin_axis_pairs = map(1:3) do i | |
data_axis = Axis(f[1, 1]) | |
label_axis = Axis(twin_ax_layout[1, i], width = 0, alignmode = Outside(), yaxisposition = :right) | |
hidedecorations!(data_axis) | |
hidespines!(data_axis) | |
hidexdecorations!(label_axis) | |
linkyaxes!(data_axis, label_axis) | |
linkxaxes!(main_ax, data_axis) | |
return data_axis, label_axis | |
end | |
for ((dax, lax), color) in zip(twin_axis_pairs, [:red, :green, :blue]) | |
lines!(dax, cumsum(randn(100)); color) | |
lax.yticklabelcolor = color | |
lax.ytickcolor = color | |
lax.rightspinecolor = color | |
lax.leftspinecolor = color | |
end | |
f |
Author
jkrumbiegel
commented
Mar 27, 2025

Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment