Mark each scatter point uniquely

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

8 Likes