I have a few equally-spaced values between 0.0 and 1.0:

[0.0, 0.1, 0.85, 0.9, 1.0]

and I want a function f(n) that returns a suitably close value for any other n between 0.0 and 1.0. So a value of 0.5 would lie on some kind of line that meanders through all the known points.

Pleasure to be able to help the creator of JuliaMono, which I use heavily wherever I can - in the grand scheme of things that was probably the greater contribution

(There’s a lot of interpolation going on in the font creation application too - the seven weights are interpolated between just a few “masters”. Although the interpolation is carried out automatically, so I never have to think about it.)

The answers so far pass exactly through all known points, which is not what you originally drew.

There are alternatives using eg least squares fitting instead of interpolation that would give something closer to your original drawing, if that would be of interest.

What do these “few equally-spaced values between 0.0 and 1.0” represent?
(by “equally-spaced”, I assume these are y-values that go with equidistant xs)

There’s an implementation of the Hobby algorithm for TikZ: http://mirrors.ctan.org/graphics/pgf/contrib/hobby/hobby.pdf that I liked a lot when I was trying to define a naturally-looking curve by specifying as few points as possible. It would be great to have something like that for Julia (I don’t think anyone has implemented it yet). But I don’t know how the position on the curve is parameterized, which is essential for your application.

Ah! This is so nice. Sorry, couldn’t hold myself and here is colorscheme maker together with palette extraction

using UrlDownload, ParallelKMeans
using ImageMagick
using ImageCore
using StatsBase
function extract_palette(url, k)
img = urldownload(url, parser = ImageMagick.load ∘ IOBuffer)
points = Float64.(channelview(vec(img)))
res = kmeans(Hamerly(), points, k)
palette = map(1:k) do i
RGB(res.centers[:, i]...)
end
cnts = sort([x for x in countmap(res.assignments)], by = x -> x[2], rev = true)
cnts = map(x -> x[1], cnts)
palette[cnts]
end

I was never convinced that the clustering was doing the right thing - I gather the process is not deterministic, but I sometimes thought there were colors in the result that weren’t in the original…

Never done it myself, but I was told that color clusterization should be done in other colorspaces, not in RGB (maybe it’s already done in ColorSchemeTools). Regarding clusterization, ordering is different, but clustering more or less the same for different runs.