GlobtimPlots.jl

Makie-based figures for the Globtim global optimization pipeline: level sets of a polynomial approximant with its critical points, Morse (Hessian) diagnostics, degree sweeps, adaptive-subdivision partitions and experiment-campaign summaries.

GlobtimPlots sits at the visualization layer of the Globtim ecosystem and contains no algorithms or statistics of its own:

Globtim → GlobtimPostProcessing → GlobtimPlots
(compute)   (results, statistics)  (figures)

Sample outputs regenerated by examples/gallery.jl:

Polynomial approximation level set — cairo_plot_polyapprox_levelset on the six-hump camel function:

Camel level-set with critical points

Adaptive subdivision partition — plot_subdivision_partition on an anisotropic test function (high frequency in x₁, low frequency in x₂). The algorithm subdivides only along x₁; color encodes log10 L2 error per leaf:

Anisotropic subdivision

Convergence vs polynomial degree — camel degree sweep with L2 approximation error (log scale) and number of recovered critical points. Both pivot between degree 4 and degree 6:

Camel — L2 error and CP count vs degree

Morse spectrum at each critical point — Hessian eigenvalues as a vertical segment from λ₁ to λ₂, colored by Morse classification. Minima above y=0 (positive definite), maxima below (negative definite), saddles cross the Morse threshold:

Camel — full Hessian spectrum

Installation

Requires Julia 1.12 or newer.

using Pkg
Pkg.add("GlobtimPlots")            # once the registration in General completes;
                                   # until then: Pkg.add(url = "https://github.com/gescholt/GlobtimPlots.jl")
Pkg.add("CairoMakie")              # a Makie backend, for PNG / PDF / SVG files
Pkg.add(["HomotopyContinuation", "DynamicPolynomials"])   # Globtim's critical-point solver

Globtim is a dependency and comes in automatically. GlobtimPlots depends on Makie but on no backend, so load one next to it: using GlobtimPlots, CairoMakie. Add GLMakie for interactive windows, GraphMakie for plot_subdivision_tree and GlobtimPostProcessing for the capture-analysis plots (see Backends).

Quick start

Approximate a test function with Globtim, solve for the critical points of the approximant, and draw the level set with those points overlaid:

using Globtim, GlobtimPlots, CairoMakie
using DynamicPolynomials: @polyvar
import HomotopyContinuation  # enables Globtim's :hc solver (`import`: it also exports a `save`)

# 1. Fit a degree-6 Chebyshev polynomial to the six-hump camel function on [-5, 5]^2
f  = camel
TR = TestInput(f; dim = 2, center = [0.0, 0.0], sample_range = 5.0, GN = 200)
pol = Constructor(TR, 6; basis = :chebyshev, precision = RationalPrecision)

# 2. Critical points of the approximant, refined on f and classified by their Hessian
@polyvar x[1:2]
sols = solve_polynomial_system(x, 2, 6, pol.coeffs;
    basis = pol.basis, precision = pol.precision, normalized = pol.normalized)
df_cp = process_crit_pts(sols, f, TR)
df_cp, df_min = analyze_critical_points(f, df_cp, TR; tol_dist = 0.01, verbose = false)

# 3. Level set of the approximant with the critical points overlaid
fig = cairo_plot_polyapprox_levelset(
    adapt_polynomial_data(pol), adapt_problem_input(TR), df_cp, df_min;
    chebyshev_levels = true, title = "Six-hump camel — Chebyshev degree 6",
)
save("camel_levelset.png", fig)

The Tutorial continues this session with the Morse diagnostics, a degree sweep, an adaptive subdivision and campaign summaries, with every figure rendered at build time; the same code is executed by the test suite. The API Reference lists every function with its keyword arguments.