So it slightly awkward but works pretty well:
struct Solution
data::Any
end
function Makie.plot(P::Type{<: AbstractPlot}, fig::Makie.FigurePosition, arg::Solution; axis = NamedTuple(), kwargs...)
menu = Menu(fig, options = ["viridis", "heat", "blues"])
funcs = [sqrt, x->x^2, sin, cos]
menu2 = Menu(fig, options = zip(["Square Root", "Square", "Sine", "Cosine"], funcs))
fig[1, 1] = vgrid!(
Label(fig, "Colormap", width = nothing),
menu,
Label(fig, "Function", width = nothing),
menu2;
tellheight = false, width = 200)
ax = Axis(fig[1, 2]; axis...)
func = Node{Any}(funcs[1])
ys = @lift($func.(arg.data))
scat = plot!(ax, P, Attributes(color = ys), ys)
cb = Colorbar(fig[1, 3], scat)
on(menu.selection) do s
scat.colormap = s
end
on(menu2.selection) do s
func[] = s
autolimits!(ax)
end
menu2.is_open = true
return Makie.AxisPlot(ax, scat)
end
f = Figure();
lines(f[1, 1], Solution(0:0.3:10))
scatter(f[1, 2], Solution(0:0.3:10))
f |> display