Hi, I’m stumbling across the fact that Luxor.Table looks row-major but Julia matrices are column-major.
How can I “swap” dimension indices between source matrix read access and Luxor.Table write access?
using Luxor
width = 100
height = 100
m = [[1,2] [3,4]]
table = Table(size(m)[2], size(m)[1], 20, 20, Point(width / 2, height / 2))
Drawing(width, height, :rec)
background("darkgray")
fontsize(22)
fontface("Monaco")
sethue("red")
for n in eachindex(table)
Luxor.text(string(m[n]), table[n], halign=:center, valign=:middle)
end
snapshot(fname=string(@__DIR__, "/tmp/test.png"))
finish()
display(m)
Result:
display(m) output:
2×2 Matrix{Int64}:
1 3
2 4
My experiments with the CartesianIndices() iterator failed so far. I want to avoid permutedims(m) because this seems to be slow, but I may be wrong about this…