PlotlyJS

PlotlyJS.jl can be used to visualize the clusters of a tree.

Visualizing a TwoNTree

For TwoNTrees we have the helper-function tracecube, which can, for example, used like this

using CompScienceMeshes
using H2Trees
using PlotlyJS

m = meshsphere(1.0, 0.1)
tree = TwoNTree(vertices(m), 0.1)

traces = [wireframe(skeleton(m, 1))]

for node in H2Trees.LevelIterator(tree, 4)
    push!(traces, H2Trees.tracecube(tree, node; mode="lines", line_color=:pink))
end

p = PlotlyJS.plot(
    traces,
    Layout(;
        scene=attr(;
            xaxis=attr(; visible=false),
            yaxis=attr(; visible=false),
            zaxis=attr(; visible=false),
        ),
        showlegend=false,
    ),
)

Visualizing a BoundingBallTree

For BoundingBallTrees we have the helper-function traceball, which can, for example, used like this

using CompScienceMeshes
using H2Trees
using PlotlyJS
using ParallelKMeans

m = meshsphere(1.0, 0.1)
tree = KMeansTree(vertices(m), 4; minvalues=60)

traces = [wireframe(skeleton(m, 1))]

for node in H2Trees.LevelIterator(tree, 4)
    push!(
        traces,
        H2Trees.traceball(tree, node; colorscale=[[0, :pink], [1, :pink]],
        opacity=0.6, showscale=false),
    )
end

p = PlotlyJS.plot(
    traces,
    Layout(;
        scene=attr(;
            xaxis=attr(; visible=false),
            yaxis=attr(; visible=false),
            zaxis=attr(; visible=false),
        ),
    ),
)