I am working on point cloud alignment model and want to show the initial alignment vs the final alignment on a 2d dataset. I also want to show the alignment between point pairs just for curiosity.
For demonstration purposes (which I “inspired” by the PGFPlotsX examples) :
using PGFPlotsX
using SyntheticDatasets:make_moon
MoonData = make_moons(n_samples=200, shuffle=true, noise=0.02);
X, Y = Matrix(MoonData[:, 1:2]), MoonData[:, 3];
# plotting
@pgf Axis(
{
"scatter/classes" = {
0 = {mark = "square*", "blue"},
1 = {mark = "triangle*", "red"},
}
},
Plot(
{
scatter,
"only marks",
"scatter src" = "explicit symbolic",
},
Table(
{
meta = "label"
},
x = X[:, 1],
y = X[:, 2],
label = Y,)),)
This plots the initial state of 2 point clouds. In addition to this, I also want to plot the initial unrelated alignments which I tried with the following:
blues = X[1:100, :];
reds = X[101:end, :];
F = reshape(hcat(blues, reds)', 2, 200) |> permutedims
@pgf Axis(
{
"scatter/classes" = {
0 = {mark = "square*", "blue"},
1 = {mark = "triangle*", "red"},
}
},
Plot(
{
scatter,
"only marks",
"scatter src" = "explicit symbolic",
},
Table(
{
meta = "label"
},
x = X[:, 1],
y = X[:, 2],
label = Y,)),
for i in 1:2:size(F, 1) - 1
Plot(Table(F[i:i+1, :]))
end )
The variable F represents the data points which “should” be related. So F[1, :] and F[2, :] are related.
F[3, :] and F[4, :] are related and so on (F[i, :] ,F[i+1, :] )
When I try the above code, unfortunately it gives the following error :
ERROR: `Nothing` does not support the Table interface
How is it possible to show a “link” between 2 sets of points ?
B.R.