scatterplot — Plot complex samples as constellation points.
scatterplot(x) plots the real and imaginary components of complex samples against each other. Optional decimation, zero-based offset, marker style, and existing scatter figure follow the Communications Toolbox call forms.
Syntax
h = scatterplot(x)
h = scatterplot(x, n)
h = scatterplot(x, n, offset)
h = scatterplot(x, n, offset, marker)
h = scatterplot(x, n, offset, marker, scatfig)Inputs
x- Type
NumericArray- Required
- Yes
- Description
- Complex-baseband samples. Real inputs are plotted with zero imaginary part.
x- Type
NumericArray- Required
- Yes
- Description
- Complex-baseband samples.
n- Type
IntegerScalar- Required
- Yes
- Description
- Positive decimation factor; every n-th sample is plotted.
offset- Type
IntegerScalar- Required
- Yes
- Description
- Zero-based sample offset before decimation.
n- Type
IntegerScalar- Required
- Yes
- Description
- Positive decimation factor.
marker- Type
StyleSpec- Required
- Yes
- Description
- Marker LineSpec forwarded to scatter.
scatfig- Type
NumericScalar- Required
- Yes
- Description
- Existing figure handle used for the scatter plot.
Returns
h- Type
NumericScalar- Description
- Figure/graphics handle returned by the underlying scatter plot.
Errors
RunMat:scatterplot:InvalidArgument- When
- The input samples, decimation factor, offset, marker, or existing Figure handle is invalid.
- Message
scatterplot: invalid argument
RunMat:scatterplot:PlotFailed- When
- The underlying scatter plot cannot be rendered.
- Message
scatterplot: plot operation failed
Call forms and figure state
scatterplot(x) draws every sample with a constellation marker. scatterplot(x,n) draws every nth sample. The offset form starts at zero-based offset, equivalent to x(offset+1:n:end). Marker is a LineSpec forwarded to scatter.
The fifth argument scatfig is an existing Figure handle, not an axes handle. The plot uses equal x/y scaling and grid lines. The returned handle is the underlying scatter graphics handle. Plotting changes local figure state and may invoke figure observers.
The MATLAB-compatible sample classes are single and double, with double integer-valued n and offset. RunMat mode also admits real fixed-width sample values when exactly representable in binary64 and typed-integer decimation controls. Strict MATLAB mode rejects those extensions before plotting.
GPU and execution
scatterplot is a rendering sink and a fusion boundary. For a supported non-decimated GPU input, the provider can expose resident real/imaginary buffers to the shared GPU scatter renderer. Decimation or unsupported splitting gathers once, then uses the same scatter and axes behavior.
Rendering requires a local user-interface context and is not transferable as a remote worker graphics handle. Numeric inputs are validated before figure selection; provider readback or rendering may suspend.
Examples
Plot four QPSK symbols
x = [1+1i;-1+1i;-1-1i;1-1i]; h = scatterplot(x);Plot every fourth sample with a marker
rx = randn(1000,1)+1i*randn(1000,1); h = scatterplot(rx,4,0,'gx');Add points to an existing scatter figure
h1 = scatterplot([1+1i;1-1i]); h2 = scatterplot([-1+1i;-1-1i],1,0,'b.',gcf());Using scatterplot with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how scatterplot changes the result.
Run a small scatterplot example, explain the result, then change one input and compare the output.
FAQ
How does scatterplot differ from scatter?⌄
scatterplot takes one complex sample array and derives its real and imaginary coordinates; scatter takes separate x and y coordinates. scatterplot also supports Communications Toolbox decimation and offset controls.
Does scatterplot support gpuArray inputs?⌄
Yes. A supported no-decimation input can be rendered from provider-resident real and imaginary buffers. Decimated or unsupported inputs gather once before rendering.
Related guides
Source you can read
Every RunMat function's source is public. Read exactly how scatterplot is executed, line by line, in Rust.
- View the source for scatterplot in Rust on GitHub
- Learn how the RunMat runtime works
- Found a bug? Open an issue with a minimal reproduction.
About RunMat
RunMat is a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/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.