Mark each scatter point uniquely

I am making a scatter plot with 10 points. I need to be able to identify each point individually since they will move and I want to track their movement.

Is it possible to mark each points with numbers? Or some unique symbols individually?

I am using Plots.jl.

plot(x, y; st=:scatter, texts=1:length(x))

works if you’re fine with kind of ugly.

2 Likes

For the 10 different colors :

scatter(rand(10), rand(10), c=distinguishable_colors(10), ms=7, legend=false)
2 Likes

The following 2-in-1 may please:

using Plots; gr()

x, y = rand(10), rand(10)
dy = diff([extrema(y)...])[1]/20  # adjust offset if needed
c = distinguishable_colors(10)
scatter(x, y, c=c, ms=7, legend=false)
[annotate!(x, y+dy, Plots.text(string(i), c[i], 12)) for (i,x, y) in zip(1:10,x,y)];
plot!()

Plots_annotated_with_different_colors
theme(:dark)
Plots_annotated_with_different_colors2

6 Likes