Colored lines

using CairoMakie, ColorSchemes

xs = 0:0.01:1
p = -10:1:10
p = filter(x -> x != 0, collect(p))
psize = length(p)
ys = zeros(length(xs), psize)
for (indx, i) in enumerate(p)
    if i <= -1
        ys[:, indx] = xs .^ (1 / abs(i))
    elseif i >= 1
        ys[:, indx] = xs .^ i
    end
end
cbarPal = :thermal
cmap = cgrad(colorschemes[cbarPal], psize, categorical = true)
fig = Figure(resolution = (600, 400), fonts = (; regular= "CMU Serif"))
ax = Axis(fig[1, 1], aspect = 1, xlabel = L"x", ylabel = L"x^{p}",
    xlabelsize = 22, ylabelsize = 22)
[lines!(xs, ys[:, v], color = cmap[v], label = "$(p[v])") for v in 1:psize]
Legend(fig[1, 2], ax, L"p"; nbanks = 2)
colsize!(fig.layout, 1, Aspect(1, 1.0))
fig

Warning

This example was autogenerated using:

using Pkg
Pkg.status(["CairoMakie", "ColorSchemes"])
Status `~/work/BeautifulMakie/BeautifulMakie/docs/Project.toml`
  [13f3f980] CairoMakie v0.10.6
  [35d6a980] ColorSchemes v3.21.0

This page was generated using Literate.jl.