polarscatter — Create scatter charts in polar coordinates.
polarscatter converts angular/radial point data to cartesian scatter coordinates, marks the active axes as polar, and preserves the original ThetaData and RData on returned scatter handles.
Syntax
ps = polarscatter(theta, rho)
ps = polarscatter(theta, rho, sz)
ps = polarscatter(theta, rho, sz, c)
ps = polarscatter(___, mkr)
ps = polarscatter(___, 'filled', Name, Value)
ps = polarscatter(pax, ___)Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
theta | NumericArray | Yes | — | Angular coordinates in radians. |
rho | NumericArray | Yes | — | Radial coordinates. |
sz | NumericArray | No | 36 | Marker area in points squared, as scalar, vector, or matrix. |
c | Any | No | — | Marker color as color name, RGB triplet, scalar vector, or RGB matrix. |
args | Any | Variadic | — | Optional marker, filled flag, axes handle, and name/value properties. |
Returns
| Name | Type | Description |
|---|---|---|
ps | Any | Scatter handle or row-vector of scatter handles. |
Errors
| Identifier | When | Message |
|---|---|---|
RunMat:polarscatter:InvalidArgument | Input data, size/color/style arguments, or axes targeting are invalid. | polarscatter: invalid argument |
RunMat:polarscatter:Internal | Internal polar scatter construction or rendering fails unexpectedly. | polarscatter: internal operation failed |
How polarscatter works
polarscatter(theta, rho)interprets theta values as radians and requires theta and rho to have compatible element counts.- Vector theta with matrix rho, matrix theta with vector rho, and matching theta/rho matrices create one scatter object per matrix column.
polarscatter(theta, rho, sz)accepts scalar, vector, or matrix marker-size data. Matrix sizes are sliced by series when theta/rho expands to multiple scatter objects.polarscatter(theta, rho, sz, c)accepts the same positional color forms asscatter, including color names, RGB triplets, scalar color values, and RGB matrices.- Marker strings, the
filledflag, and common scatter name/value options share the parser used byscatter. - The returned value is a scalar scatter handle for one series or a row-vector of scatter handles for multiple series.
get(h, 'ThetaData')andget(h, 'RData')return the stored polar source coordinates. Setting either property recomputes the cartesianXDataandYDataused by the renderer.- The target axes are switched to polar mode with equal x/y scaling and symmetric cartesian limits based on the largest radius.
Options
- Use
polarscatter(ax, theta, rho, ...)to target existing axes. - Use marker symbols such as
'o','+', and'x'after the size/color arguments. - Use
hold onbefore additionalpolarscattercalls to overlay more polar scatter objects on the same axes. - Use
set(h, ...)on returned handles to update scatter properties after plotting.
Examples
Create a polar scatter chart
theta = linspace(0, 2*pi, 20);
rho = abs(sin(theta));
h = polarscatter(theta, rho);Expected output:
% h is a scatter handle with ThetaData and RDataUse filled markers with sizes and colors
theta = pi/4:pi/4:2*pi;
rho = [19 6 12 18 16 11 15 15];
sz = 100*[6 15 20 3 15 3 6 40];
c = [1 2 2 2 1 1 2 1];
polarscatter(theta, rho, sz, c, 'filled');Create multiple scatter series from a matrix
theta = [0 pi/6 pi/2];
rho = [1 2; 2 4; 5 6];
ps = polarscatter(theta, rho, [50 100; 75 125; 100 150]);Expected output:
% ps is a row-vector with one handle for each rho columnUsing polarscatter with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how polarscatter changes the result.
Run a small polarscatter example, explain the result, then change one input and compare the output.
FAQ
Does polarscatter keep the original polar data?⌄
Yes. The renderer uses cartesian XData and YData, but the scatter handle also stores ThetaData and RData for MATLAB-style inspection and updates.
Are table-based polarscatter forms supported?⌄
The numeric and axes-targeted plotting forms are supported. Table variable forms depend on the broader table plotting surface and are not treated as complete by this builtin alone.
Related Plotting functions
2D Charts
area · bar · errorbar · heatmap · hist · histogram · loglog · pie · plot · scatter · semilogx · semilogy · stairs · stem
Other
addpoints · ancestor · animatedline · axes · barh · cla · clf · colorcube · colororder · copyobj · daspect · datacursormode · dataTipTextRow · fcontour · figure · fill3 · findobj · fsurf · gobjects · groot · hgload · hgsave · hidden · histogram2 · hold · line · linkaxes · openfig · opengl · pan · parula · patch · plotmatrix · plotyy · polarhistogram · polarplot · print · quiver3 · ribbon · saveas · savefig · sphere · stackedplot · subtitle · suptitle · textscatter · textscatter3 · triplot · waitbar · wordcloud · xline · xscale · xtickangle · xtickformat · xticklabels · xticks · yline · yscale · ytickangle · ytickformat · yticklabels · yticks · zoom
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.