How is it possible to show "links/alingments" between 2 sets of points using PGFPlotsX.jl?

Ok, here is the solution I came with:


 @pgf gp = 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,)),)

c = hcat(blues, reds)
P = [c[i, :] for i in 1:size(c, 1)];

 @pgf for (i, ps) in enumerate(P)
           push!(gp, PlotInc(Coordinates(ps)))
 end

I did not imagine that PGFPlotsX has such easiness.

Edit: Adding some more colors :

using Colors
colors = [LCHuv(65, 100, h) for h in range(15; stop = 360+15, length = n+1)][1:size(P, 1)]

@pgf for (i, ps) in enumerate(P)
           push!(gp, PlotInc({color=colors[i]}, Coordinates(ps)))
  end

1 Like