-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.jl
More file actions
34 lines (25 loc) · 678 Bytes
/
plot.jl
File metadata and controls
34 lines (25 loc) · 678 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using Plots
function euclidean_coords_simplex()
s1 = [0, 0, 0]
s2 = [1, 0, 0]
s3 = [0.5, sqrt(3) / 2, 0]
s4 = [0.5, sqrt(3) / 4, sqrt(3) / 2]
hcat(s1, s2, s3, s4)'
end
function plot_simplex(; kwargs...)
c = euclidean_coords_simplex()
for i in 1:4, j in i+1:4
plot!(eachcol(c[[i, j], :])...; kwargs...)
end
plot!()
end
function bary_to_euclidean(x::AbstractMatrix)
x * euclidean_coords_simplex()
end
function scatter_chi(chi; kwargs...)
c = bary_to_euclidean(chi)
scatter!(eachcol(c)...; kwargs...)
end
function plot_path(chi, path; kwargs...)
plot!(eachcol(bary_to_euclidean(chi[path, :]))...; kwargs...)
end