Visualization

HermiteSpline provides extensions for plotting with Plots or Makie.

Plots

s = hermitespline(2)
push!(s, 0.0, @SVector([0.0, 0.0]), @SVector([0.0, +1.0]))
push!(s, 1.0, @SVector([1.0, 0.0]), @SVector([0.0, -1.0]))

using Plots
plot(s)
plot(s; density = 100, idxs = (2, 1))   # swap x and y coordinate

An AbstractHermiteSpline can be displayed by Plots.plot or Plots.plot!. The optional keyword arguments density and idx give the number of samples and the dimensions of the coordinates (similar to plotting solutions of DifferentialEquations). The uniform sampling will be "merged" with all values of h prior to plotting.

Warning

Plotting Hermite splines with Plots is currently restricted to 2d plots, i.e., length(idxs)==2.

Makie

s = hermitespline(2)
push!(s, 0.0, @SVector([0.0, 0.0]), @SVector([0.0, +1.0]))
push!(s, 1.0, @SVector([1.0, 0.0]), @SVector([0.0, -1.0]))

using GLMakie
plot(s)
Note

There is currently only a minimal recipe for Makie plots, which doesn't support extra arguments (like density or idxs for Plots).

Note

The Makie supports 2d and 3d plots.