Interactive 2D & 3D Gallery
Every figure below renders directly onto HTML Canvas2D with zero PNGs. Start with a 5-line snippet, drag the interactive 3D scenes in WasmGC, or filter the full recipe catalog.
Simple 5-Line Starters
Minimal copy-and-run examples in both 2D Axis and 3D Axis3. Expand any card below to copy the exact Julia snippet.
View Julia snippet2D Starter
using WasmMakie
xs = collect(range(0.0, 2pi; length = 80))
fig, ax, _ = lines(xs, sin.(xs); linewidth = 2.4, label = "sin(x)")
scatter!(ax, xs[1:8:end], sin.(xs[1:8:end]); color = Cycled(2), markersize = 8)
save("wave.html", fig)View Julia snippet3D Starter
using WasmMakie
fig = Figure(size = (520, 380))
ax = Axis3(fig[1, 1]; title = "Paraboloid", xlabel = "x", ylabel = "y", zlabel = "z")
xs = ys = collect(range(-2.0, 2.0; length = 25))
surface!(ax, xs, ys, [x^2 - y^2 for x in xs, y in ys]; colormap = :plasma)
save("saddle3d.html", fig)View Julia snippetColormap
using WasmMakie
fig = Figure(size = (520, 360))
ax = Axis(fig[1, 1]; title = "Gaussian Field", xlabel = "x", ylabel = "y")
xs = ys = collect(range(-2.5, 2.5; length = 30))
hm = heatmap!(ax, xs, ys, [exp(-(x^2 + y^2)) for x in xs, y in ys]; colormap = :viridis)
Colorbar(fig[1, 2], hm)View Julia snippet3D Starter
using WasmMakie
fig = Figure(size = (520, 380))
ax = Axis3(fig[1, 1]; title = "3D Helix", xlabel = "x", ylabel = "y", zlabel = "z")
ts = collect(range(0.0, 6pi; length = 75))
scatter!(ax, cos.(ts), sin.(ts), ts ./ 2pi; color = ts, colormap = :turbo, markersize = 9)Interactive 3D Axis3
Real 3D camera projection, Blinn-Phong lighting, and z-buffered surface rasterization compiled from pure Julia to WasmGC with zero Three.js and zero Julia server. Drag directly on either canvas to orbit or scroll to zoom.
View Julia source for 3D Wave SurfaceAxis3 + surface! + wireframe!
using WasmMakie
fig = Figure(size = (880, 480))
ax = Axis3(
fig[1, 1];
title = "Interactive 3D Wave Surface",
xlabel = "x",
ylabel = "y",
zlabel = "sinc(r)",
azimuth = 1.275 * pi,
elevation = pi / 8,
perspectiveness = 0.25,
)
xs = collect(range(-6.0, 6.0; length = 25))
ys = collect(range(-6.0, 6.0; length = 25))
zs = [let r = sqrt(x^2 + y^2); r == 0.0 ? 1.0 : sin(r) / r end for x in xs, y in ys]
sf = surface!(ax, xs, ys, zs; colormap = :viridis)
wireframe!(ax, xs, ys, zs; color = (:black, 0.22), linewidth = 0.6)
Colorbar(fig[1, 2], sf; label = "Amplitude")
save("sombrero3d.html", fig)View Julia source for Lorenz Strange AttractorAxis3 + lines! + scatter!
using WasmMakie
sigma, rho, beta, dt = 10.0, 28.0, 8.0 / 3.0, 0.0085
n = 1400
xs, ys, zs, speed = Float64[], Float64[], Float64[], Float64[]
x, y, z = 1.0, 1.0, 1.0
for _ in 1:n
push!(xs, x); push!(ys, y); push!(zs, z)
dx, dy, dz = sigma * (y - x), x * (rho - z) - y, x * y - beta * z
push!(speed, sqrt(dx^2 + dy^2 + dz^2))
x += dt * dx; y += dt * dy; z += dt * dz
end
fig = Figure(size = (880, 480))
ax = Axis3(fig[1, 1]; title = "Lorenz Strange Attractor", perspectiveness = 0.3)
ln = lines!(ax, xs, ys, zs; color = speed, colormap = :plasma, linewidth = 1.7)
scatter!(ax, [xs[1], xs[end]], [ys[1], ys[end]], [zs[1], zs[end]]; color = [speed[1], speed[end]], colormap = :plasma, markersize = 10)
Colorbar(fig[1, 2], ln; label = "Speed ||v||")
save("lorenz3d.html", fig)Multi-Panel 2D + 3D Layouts
Combine 2D Axis, 3D Axis3, and shared Colorbar blocks inside a single Makie GridLayout, or drive four linked panels reactively from WasmGC signals.
View Julia source for 2D Contourf + 3D SurfaceAxis + Axis3 + Colorbar
using WasmMakie
xs = collect(range(-3.0, 3.0; length = 31))
ys = collect(range(-3.0, 3.0; length = 31))
zs = [
1.8 * exp(-0.45 * ((x - 0.6)^2 + (y - 0.4)^2)) -
1.1 * exp(-0.65 * ((x + 1.0)^2 + (y + 0.8)^2)) +
0.25 * sin(1.5 * x) * cos(1.5 * y)
for x in xs, y in ys
]
fig = Figure(size = (920, 420))
ax2 = Axis(fig[1, 1]; title = "2D Topographic Contours", xlabel = "x (km)", ylabel = "y (km)")
cf = contourf!(ax2, xs, ys, zs; colormap = :viridis, levels = 12)
contour!(ax2, xs, ys, zs; color = (:black, 0.25), levels = 12, linewidth = 0.7)
ax3 = Axis3(fig[1, 2]; title = "3D Surface Elevation", zlabel = "elevation", perspectiveness = 0.2, protrusions = (54, 26, 30, 30))
surface!(ax3, xs, ys, zs; colormap = :viridis)
wireframe!(ax3, xs, ys, zs; color = (:black, 0.16), linewidth = 0.5)
Colorbar(fig[1, 3], cf; label = "Elevation")
save("topography_2d_3d.html", fig)View Julia source for LiveDashboardLiveDashboard.jl
import WasmMakie as WM
using WasmMakie: band!, barplot!, heatmap!, lines!, scatter!
@island hydrate = :visible function LiveDashboard()
freq, set_freq = create_signal(Int64(3))
n_pts, set_n_pts = create_signal(Int64(16))
shift, set_shift = create_signal(Int64(0))
create_effect(
() -> begin
fig = _build_dashboard_figure(freq(), n_pts(), shift())
WM.render!(fig, WM.WasmCtx())
end,
)
...
endFull 2D & 3D Recipe Gallery
All 39 live Canvas2D figures below (7 3D Axis3 scenes and 32 2D recipes) are generated at build time through html_snippet(fig; hidpi = true) with bundled fonts. For full attribute reference, see docs.makie.org.