Created
September 28, 2024 06:46
-
-
Save jkrumbiegel/b752f7882adc8ccea01022c4251cf602 to your computer and use it in GitHub Desktop.
Latex or typst like matrix or table typesetting in 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
using CairoMakie | |
f = Figure(fonts = (; regular = "CMU")) | |
Label(f[1, 1], "Weights", fontsize = 20) | |
gl = GridLayout(f[2, 1]) | |
for i in 1:5, j in 1:5 | |
text = if i <=3 && j <= 3 | |
rich("w", subscript("$i,$j")) | |
elseif i == 4 && j == 4 | |
rich("⋱") | |
elseif i == 4 | |
rich("⋮") | |
elseif j == 4 | |
rich("⋯") | |
else | |
rich("w", subscript("$(i == 5 ? 'm' : i),$(j == 5 ? 'n' : j)")) | |
end | |
Label(gl[i, j], text, padding = (4, 4, 4, 4)) | |
if i == 4 || i == 5 && j == 1 | |
Box(gl[i, j], color = :transparent, strokecolor = :orange) | |
end | |
colgap!(gl, 10) | |
rowgap!(gl, 4) | |
end | |
bracket!(f.scene, @lift(Makie.leftline($(gl.layoutobservables.computedbbox))), style = :square, width = 10, offset = 5) | |
bracket!(f.scene, @lift(Makie.rightline($(gl.layoutobservables.computedbbox))), style = :square, orientation = :down, width = 10, offset = 5) | |
Axis3(f[1:2, 2]) | |
surface!(cumsum(randn(30, 30), dims = 1)) | |
f |
Author
jkrumbiegel
commented
Sep 28, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment