Scatter pallete application

There’s a slight misunderstanding here of how colours are applied in calls to scatter: every call to scatter creates a group of points which all have the same colour, by default the first colour of whatever colour palette you are specifying.

If you then call scatter! again (note the !, which indicates that the existing plot is modified), the next colour of your chosen colour palette is applied to the next group of points. Consider:

julia> using Plots

julia> scatter(ones(10), rand(10), palette = :tab20b)

julia> scatter!(1 .+ ones(10), rand(10), palette = :tab20b)

julia> scatter!(2 .+ ones(10), rand(10), palette = :tab20b)

julia> scatter!(3 .+ ones(10), rand(10), palette = :tab20b)

julia> scatter!(4 .+ ones(10), rand(10), palette = :tab20b)

julia> scatter!(5 .+ ones(10), rand(10), palette = :tab20b)

which creates:

image

If you want different colours within one series, you need to specify a vector of colours of the same length as the number of points you’re looking to plot:

julia> scatter(1:10, 1:10, palette = :tab20b, color = 1:10)

image