Impressive!
How should I add lines between points in a plot like this?
Can this be done with PGFPlotsX?
This can also be done using Makie.jl:
This is much easier than I had thought, for anyone that comes next here is the recipe (See Makie docs has a more generic scatter example and examples for colored lines :
using CairoMakie
# create synthetic data
n = 1000;
x = 1:n;
y = sin.(collect(x) .* .05);
z = vcat(1:n/2, n/2:-1:1) .- n/4
# set color axis limits which by default is automatically equal to the extrema of the color values
colorrange = [-n/4, n/4];
# choose color map [https://docs.juliahub…
Fourier
November 2, 2025, 3:11pm
23
Because I havent seen that solution here. I just do it like this:
using Plots
x = rand(100)
y = rand(100)
z = x.^2 + y.^2 + 0.1randn(100)
scatter(x, y, zcolor=z)
savefig("scatter_plot.png")
Fourier:
zcolor=z
For your information, zcolor is one of the aliases for the marker_z attribute (see Plots.jl series attributes ). So, this is the same as the post above .