textscatter3 — Create a 3-D text scatter chart from x/y/z coordinates and text labels.

textscatter3(x,y,z,str) creates a 3-D text scatter chart with labels from str at matching x/y/z coordinates. textscatter3(xyz,str) accepts an N-by-3 coordinate matrix. The returned handle is a textscatter chart object with data and display properties.

Syntax

ts = textscatter3(x, y, z, str)
ts = textscatter3(xyz, str)
ts = textscatter3(ax, ...)
ts = textscatter3(..., Name, Value)

Inputs

NameTypeRequiredDefaultDescription
xNumericArrayYesX coordinates.
yNumericArrayYesY coordinates.
zNumericArrayYesZ coordinates.
strAnyYesString vector or cell array of character vectors.
xyzNumericArrayYesN-by-3 coordinate matrix.
propsAnyVariadicName/value TextScatter properties.

Returns

NameTypeDescription
tsNumericScalarHandle to the TextScatter chart object.

Errors

IdentifierWhenMessage
RunMat:textscatter:InvalidArgumentCoordinates, text labels, axes target, or TextScatter property values are invalid.textscatter: invalid argument
RunMat:textscatter:InternalInternal plotting state update fails while creating or mutating TextScatter.textscatter: internal operation failed

How textscatter3 works

  • x, y, z, and str must have equal element counts.
  • xyz must be an N-by-3 matrix whose first, second, and third columns provide x, y, and z coordinates.
  • str can be a string scalar, string array, character row, character matrix, or cell array of text scalars.
  • The axes-target form textscatter3(ax,...) renders into the supplied axes handle.
  • ZData is populated from the z coordinates and can be queried with get.
  • TextDensityPercentage, MaxTextLength, MarkerColor, MarkerSize, ColorData, Colors, and Visible follow the same semantics as textscatter.
  • get supports Type, Parent, Children, TextData, XData, YData, ZData, TextDensityPercentage, MaxTextLength, MarkerColor, MarkerSize, ColorData, Colors, Visible, DisplayName, and Tag.
  • set supports TextData, XData, YData, ZData, TextDensityPercentage, MaxTextLength, MarkerColor, MarkerSize, ColorData, Colors, Visible, Color, FontSize, FontWeight, FontAngle, and Interpreter.
  • Categorical ColorData, datasource properties, callbacks, app data, and interactive data-tip template objects are not implemented yet and raise explicit unsupported-property errors.

Examples

Create a 3-D text scatter chart

x = [1 2 3];
y = [4 5 6];
z = [7 8 9];
words = ["one" "two" "three"];
ts = textscatter3(x, y, z, words);

Use an N-by-3 coordinate matrix

xyz = [1 4 7; 2 5 8; 3 6 9];
textscatter3(xyz, ["one" "two" "three"]);

Read z coordinates from the chart

ts = textscatter3([1 2], [3 4], [5 6], ["a" "b"]);
get(ts, 'ZData')

Expected output:

ans =
     5     6

Using textscatter3 with coding agents

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

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

FAQ

Does textscatter3 return a different object type than textscatter?

The MATLAB chart type is textscatter for both 2-D and 3-D forms. RunMat follows that convention and distinguishes the 3-D form by storing nonempty ZData.

How are 3-D markers handled?

When markers are enabled, RunMat creates an internal scatter3 marker plot using the same coordinates and resolved marker colors.

Can textscatter3 preserve gpuArray residency?

Not currently. Text annotations require host coordinate and label materialization. Marker rendering reuses the existing scatter3 plot path once the chart has been constructed.

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how textscatter3 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.