I’m reading Eugenia Cheng’s book The Joy of Abstraction - An Exploration of Math, Category Theory, and Life. On page 61 there is an interesting diagram of all the order permutations of the multiplication 2 * 3 * 5 = 30 that looks like a cube because that multiplication is commutative.
X = [ 2, 2, 2]
Y = [ 1, 1, 1]
U = [-1, 0, 1]
V = [ 1, 1, 1]
arrows!(X,Y,U,V,
arrowsize = 25,
lengthscale = 0.74)
In my attempt to plot that diagram with GLMakie, there is an unwanted overlap of the arrow tails on the text. Is there some easy way to get lengthscale (or some other attribute) to shorten the arrow tail at the tail so that it doesn’t overlap the text?
Here’s the entire function to plot that diagram:
using GLMakie
function primes()
# initialize figure
fig = Figure(resolution = (800, 800))
LIM = (0,5, 0,6)
ls = 0.74 # arrow lengthscale
vfs = 34 # vertex font size
ax = Axis(fig[1,1], limits=LIM, aspect=1,
title = "commutative diagram of 2*3*5=30");
# commutative diagram for 2 * 3 * 5 = 30
text!(2, 1, text = "1",
align = (:center, :center),
fontsize = vfs)
text!(4, 1, text = "0 primes",
align = (:left, :center),
fontsize = 20)
text!([1,2,3], [2,2,2], text = ["2","3","5"],
align = (:center, :center),
fontsize = vfs)
X = [ 2, 2, 2]
Y = [ 1, 1, 1]
U = [-1, 0, 1]
V = [ 1, 1, 1]
arrows!(X,Y,U,V,
arrowsize = 25,
lengthscale = ls)
text!(4, 2, text = "1 prime",
align = (:left, :center),
fontsize = 20)
text!([1,2,3], [3,3,3], text = ["6","10","15"],
align = (:center, :center),
fontsize = vfs)
X = [1, 1, 2, 2, 3, 3]
Y = [2, 2, 2, 2, 2, 2]
U = [0, 1,-1, 1,-1, 0]
V = [1, 1, 1, 1, 1, 1]
arrows!(X,Y,U,V,
arrowsize = 25,
lengthscale = ls)
text!(4, 3, text = "2 primes",
align = (:left, :center),
fontsize = 20)
text!(2, 4, text = "30",
align = (:center, :center),
fontsize = vfs)
X = [1, 2, 3]
Y = [3, 3, 3]
U = [1, 0,-1]
V = [1, 1, 1]
arrows!(X,Y,U,V,
arrowsize = 25,
lengthscale = ls)
text!(4, 4, text = "3 primes",
align = (:left, :center),
fontsize = 20)
save("primes.png", fig)
fig
end