Visualization

Functions in this section are available only when the corresponding optional package is loaded alongside WeberElectrodynamics.

Plots extension (using Plots)

WeberElectrodynamics.plot_trajectoriesFunction
plot_trajectories(data::TrajectoryData) -> Plot

Plot particle trajectories in 1D, 2D, or 3D based on data.dims.

  • 1D: Position vs. time for each particle.
  • 2D: x–y scatter with equal aspect ratio and start/end markers.
  • 3D: x–y–z line plot with start/end markers.

Requires using Plots to activate the Plots.jl extension.

Arguments

  • data::TrajectoryData: Trajectory data from compute_trajectory_data.

Returns

  • A Plots.Plot object.
source
WeberElectrodynamics.plot_energyFunction
plot_energy(data::EnergyData) -> Plot

Plot total n-body energy timeseries with comprehensive error visualization.

Two-panel layout: energy components (Total, Kinetic, Potential) and relative error on a log scale with max/avg reference lines.

Requires using Plots to activate the Plots.jl extension.

source
WeberElectrodynamics.plot_pair_energyFunction
plot_pair_energy(data::EnergyData, pair::Tuple{Int,Int}) -> Plot

Plot the Weber potential decomposition for a single particle pair.

Two-panel layout: Coulomb term, velocity correction, and total pair potential vs. time; and radial velocity ṙ with approach/separation shading.

Requires using Plots to activate the Plots.jl extension.

Arguments

  • data::EnergyData: Energy data from compute_energy_timeseries.
  • pair::Tuple{Int,Int}: Particle pair indices, e.g., (1, 2).
source
WeberElectrodynamics.plot_energy_errorsFunction
plot_energy_errors(data::EnergyData) -> Plot

Plot comprehensive energy error analysis (local error, global drift, and Hamiltonian validation) in a three-panel log-scale layout.

Requires using Plots to activate the Plots.jl extension.

source
WeberElectrodynamics.plot_pair_forcesFunction
plot_pair_forces(data::PairForceData) -> Plot

Plot the Weber force decomposition for a particle pair in a four-panel layout: force magnitude, force components, vector form decomposition, and radial form decomposition.

Requires using Plots to activate the Plots.jl extension.

source
WeberElectrodynamics.plot_phase_spaceFunction
plot_phase_space(data::PairForceData) -> Plot

Plot the (r, ṙ) phase-space portrait for a particle pair with marked initial and final states.

Requires using Plots to activate the Plots.jl extension.

source
WeberElectrodynamics.plot_momentum_errorsFunction
plot_momentum_errors(data::MomentumData) -> Plot

Plot conservation errors for linear and angular momentum as two stacked log-scale panels (top: linear drift ‖ΔP‖, bottom: angular drift |ΔLz| in 2D or ‖ΔL‖ in 3D). Each legend reports max absolute drift and — when the initial magnitude is nonzero — max relative drift max_t ‖Δ·‖ / ‖·₀‖. 1D systems show only the linear panel.

Requires using Plots to activate the Plots.jl extension.

source
WeberElectrodynamics.plot_zollner_energyFunction
plot_zollner_energy(data::EnergyData) -> Plot

Visualise Zöllner potential contributions against standard Weber energies.

Two-panel layout: total potential with per-pair breakdown and Zöllner extra terms (κ values shown); Zöllner gravitational residual ΣΔV_Z compared to total energy. Only meaningful when the problem was constructed with Zöllner enabled (non-trivial kappas(prob)).

Requires using Plots to activate the Plots.jl extension.

source
WeberElectrodynamics.plot_zollner_force_residualFunction
plot_zollner_force_residual(data::PairForceData) -> Plot

Two-panel visualization of the Zöllner extra force for one particle pair: total force magnitude alongside the Zöllner extra magnitude |(κ−1)·F_Coulomb|, and the ratio of extra Zöllner force to total force.

Requires using Plots to activate the Plots.jl extension.

source
WeberElectrodynamics.plot_weber_vs_zollnerFunction
plot_weber_vs_zollner(sol1, sol2; labels=["Weber","Zöllner"]) -> Plot

Overlay trajectories from two solutions (same initial conditions, different κ) to visualise the orbital divergence introduced by the Zöllner mismatch. Solid lines = sol1, dashed lines = sol2. Requires 2D or 3D.

Requires using Plots to activate the Plots.jl extension.

source
WeberElectrodynamics.plot_zollner_phase_spaceFunction
plot_zollner_phase_space(data1, data2; labels=["Weber","Zöllner"]) -> Plot

Overlay (r, ṙ) phase portraits for the same pair from two simulations, showing how the Zöllner mismatch shifts the phase-space orbit.

Requires using Plots to activate the Plots.jl extension.

source

Makie extension (using GLMakie / using CairoMakie)

WeberElectrodynamics.animate_weberFunction
animate_weber(prob_or_sol; kwargs...) -> screen

Launch an interactive animated dashboard for a Weber simulation.

Two modes:

  • animate_weber(prob::HamiltonianProblem; ...)streaming: runs the integrator live and displays data in real time. Requires a windowed backend (GLMakie or WGLMakie).
  • animate_weber(sol::HamiltonianSolution; ...)replay: replays a completed solution.

The dashboard shows particle trajectories, energy, momentum, and phase-space panels. Requires at least 2D (dims ≥ 2).

Keywords (both modes):

  • buffer_size=2000: Rolling display window size.
  • tail_length=200: Visible trajectory tail length (≤ buffer_size).
  • compute_batch=1: Steps computed or advanced per animation frame.
  • initial_pair=(1,2): Default pair for the phase-space panel.
  • phase_mode=:pair: :pair or :particle phase-space mode.
  • initial_particle=1, initial_component=1: Phase-space selection.
  • figure_size=(1400,900): Window size in pixels.

Streaming-only keywords:

  • alg=SymmetricProjectionIntegrator(): Integrator algorithm.

Replay-only keywords:

  • stride=1: Skip every stride-th stored timestep during replay.

Requires using GLMakie (or another Makie backend) to activate the extension.

Returns

  • A Makie screen handle; close the window to stop.
source