Charts

Start with Axes() for a graph or NumberPlane() for a grid. The same coordinates place curves, markers, guides, and labels. Those visuals are Ebi elements you can place and animate.

Loading Ebi…
let ax = NumberPlane(x_range=[-6, 6, 2], y_range=[-2, 2, 1])
let amplitude = reflect(1)
fn wave(x: Number, phase: Number): Number {
    return amplitude * sin(x + phase)
}
mut phase = 0
<Plot axes={ax}>
    {ax.plot(wave, parameter=phase, fill=Color("blue2"))}
    {ax.scatter([[0, wave(0, phase)]], radius=4pt, fill=Color("orange3"))}
</Plot>
animate(phase, to=TAU, duration=3s, ease="linear")

Change Amplitude to see the curve and marker move together. They derive their coordinates from the same signal. Moving the Plot moves its axes and all of its children together. Each series can also be mounted and animated as an independent element. A plot uses the x-axis range unless you give it a separate x_range. For axes, a third range value is the tick step. In a plot's sampling range it controls the sampling step. Ebi lengths such as 320pt set x_length and y_length.

Chart guides

  • Functions and data covers axes, curves, points, and annotations.
  • Plot covers trajectories, surfaces, and animated camera transitions.
  • Flow fields covers streamlines and the Lorenz attractor.
  • Vector fields covers 3D arrows and sampling directions on a grid.
  • Distributions covers histograms, density estimates, and statistical plots.