Makie - tricontourf from matplotlib in Makie

Sorry for the delay in providing the example. I somehow had trouble coloring the filled contours, but here goes:


#tricontour working example
using TriplotBase, Triangulate, GLMakie

function append_with_nan!(a,b)
    append!(a,b)
    push!(a,NaN)
end

conttype(contour::TriplotBase.Contour{T}) where {T} = T
#create some data
x = [0.0, 0.5, 1.0, 0.25, 0.75, 0.5]
y = sqrt(3)/2*[0.0, 0.0, 0.0, 0.5, 0.5, 1.0]
z = [0.0, 0.0, 0.0, 1.0, 0.75, 0.75]

#figure and axes
fighandle = Figure(resolution = (1100, 900))
ax1 = Axis3(fighandle[1, 1], aspect = (1, sqrt(3)/2, 1))
ax2 = Axis(fighandle[1, 2], aspect = AxisAspect(2/sqrt(3)))
ax3 = Axis(fighandle[1, 3], aspect = AxisAspect(2/sqrt(3)))

scatter!(ax1, x, y, z, markersize = 2000, color = :black)

#trianulate datapoints
triin=Triangulate.TriangulateIO()
triin.pointlist=[x'; y']
(triout, vorout) = triangulate("Q", triin)
trianglelist = triout.trianglelist

#contours
contours = TriplotBase.tricontour(x, y, z, trianglelist, 15)
filledcontours = TriplotBase.tricontourf(x, y, z, trianglelist, 15)

#plot the contours in ax2 (code adapted to Makie.jl from TriplotRecipes.jl (which is for Plots.jl))
for contour=contours
    T = conttype(contour)
    xs = T[]
    ys = T[]
    zs = T[]
    for polyline=contour.polylines
        append_with_nan!(xs,first.(polyline))
        append_with_nan!(ys,last.(polyline))
        append!(zs,fill(contour.level,length(polyline)))
    end
    if !isempty(zs)
        lines!(ax2, xs, ys, color = zs, colorrange = (0.0, 1.0))
    end
end

#plot the filled contours in ax3 (code adapted to Makie.jl from TriplotGR.jl)


for filledcontour = filledcontours
    for polyline=filledcontour.polylines
        points = similar(polyline, Point2f) #this is probably horrible Julia, but it works for now.
        for i in axes(polyline)
            points[i] = polyline[i]
        end
        poly!(ax3, points)
    end
end

Currently produces this plot:

I somehow have trouble getting Makie.jl accept the “color” argument for poly! right now…so currently the righthand figure just cycles through the color…

But, it’s pretty close?