animatedline — Create an animated line graphics object for incremental plotting.

animatedline creates a graphics handle backed by RunMat's normal 2-D or 3-D line rendering paths. The handle can be updated with addpoints and queried or styled with get and set.

Syntax

an = animatedline()
an = animatedline(x, y)
an = animatedline(x, y, z)
an = animatedline(..., Name, Value)
an = animatedline(ax, ...)

Inputs

NameTypeRequiredDefaultDescription
argsAnyVariadicOptional X/Y[/Z] vectors, axes target, and Name/Value properties.

Returns

NameTypeDescription
anNumericArrayAnimated line graphics handle.

Errors

IdentifierWhenMessage
RunMat:animatedline:InvalidArgumentCoordinates, axes target, or Name/Value pairs are invalid.animatedline: invalid argument
RunMat:animatedline:InternalInternal plotting state update fails.animatedline: internal operation failed

How animatedline works

  • animatedline() creates an empty animated line on the current axes.
  • animatedline(x,y) creates a 2-D animated line with initial points.
  • animatedline(x,y,z) creates a 3-D animated line when the initial coordinate vectors are nonempty.
  • A leading axes handle or Parent name/value pair routes the animated line to explicit axes.
  • MaximumNumPoints limits retained points by dropping the oldest samples. The default is 1000000; Inf disables trimming.
  • Returned handles report Type as animatedline and support line styling properties such as Color, LineWidth, LineStyle, marker properties for 2-D animated lines, DisplayName, and Visible.

Options

  • Parent accepts an axes handle.
  • MaximumNumPoints accepts a positive numeric value or Inf.
  • Common line properties include Color, LineWidth, LineStyle, DisplayName, and Visible. Marker properties are supported for 2-D animated lines; 3-D animated lines reject marker metadata until RunMat's 3-D line renderer has marker support.

Does RunMat run animatedline on the GPU?

Construction gathers GPU coordinate vectors into the animated-line state.

Rendering still uses RunMat's existing line and line3 rendering paths after points are stored.

GPU memory and residency

animatedline accepts GPU-resident coordinate inputs but stores animated state as host-side graphics data so subsequent addpoints, get, and set operations have MATLAB-compatible handle semantics.

Examples

Create and update a 2-D animated line

an = animatedline('Color', 'r', 'MaximumNumPoints', 100);
addpoints(an, 1:3, [2 4 8]);
get(an, 'XData')

Expected output:

ans =
     1     2     3

Create a 3-D animated line

an = animatedline();
addpoints(an, [1 2], [3 4], [5 6]);
get(an, 'ZData')

Expected output:

ans =
     5     6

Using animatedline with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how animatedline changes the result.

Run a small animatedline example, explain the result, then change one input and compare the output.

FAQ

Does animatedline render through a separate animation engine?

No. RunMat stores the animated-line handle as plotting state that points at the existing LinePlot or Line3Plot object, so updates reuse the established line rendering paths.

What happens when the maximum point count is exceeded?

RunMat drops the oldest coordinates and keeps the newest MaximumNumPoints samples, matching MATLAB's compatibility behavior for streaming plots.

Can 3-D animated lines use marker properties?

Not yet. RunMat rejects marker-styled 2-D animated-line handles when callers try to promote them with addpoints(an,x,y,z) because the current 3-D line renderer does not store marker metadata.

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how animatedline is executed, line by line, in Rust.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.