RunMat
GitHub

polarplot — Create 2-D line plots in polar coordinates.

polarplot converts angular/radial data to cartesian line coordinates and marks the active axes as polar so the renderer draws concentric radial rings and angular spokes.

Syntax

polarplot(theta, rho)

How polarplot works

  • polarplot(theta, rho) interprets theta values as radians and requires theta and rho to have the same number of elements.
  • polarplot(rho) creates implicit theta values over [0, 2*pi] with the same number of samples as rho.
  • polarplot(Z) interprets complex input as theta = angle(Z) and rho = abs(Z).
  • Matrix rho or Z inputs create one polar line per column. A vector theta can be paired with a rho matrix when its length matches each column.
  • Multiple theta/rho pairs in one call create multiple line objects and return the handle for the first created series.
  • LineSpec strings and common line name/value pairs such as LineWidth, Color, Marker, and DisplayName share the same parser used by plot. A final all-name/value group applies to every line created by that call.
  • Empty data creates an empty line object, matching MATLAB graphics-object behavior.
  • The target axes are switched to polar mode with equal x/y scaling and symmetric cartesian limits based on the largest radius.

Options

  • Use MATLAB-style line specs such as 'r--', 'bo-', and ':' after a polar series.
  • Use hold on before additional polarplot calls to overlay more polar lines on the same axes.
  • Use set(h, ...) on the returned line handle to update line properties after plotting.

Examples

Plot a polar curve from theta and rho

theta = linspace(0, 2*pi, 200);
rho = abs(sin(2*theta).*cos(2*theta));
h = polarplot(theta, rho);

Expected output:

% h is a numeric handle for the first polar line

Use complex data

z = exp(1i*linspace(0, 2*pi, 100));
polarplot(z, 'r--');

Expected output:

% theta comes from angle(z), rho comes from abs(z)

Overlay multiple polar series

theta = linspace(0, 2*pi, 200);
polarplot(theta, abs(sin(theta)), 'b-');
hold on;
polarplot(theta, abs(cos(theta)), 'r--', 'LineWidth', 2);

Expected output:

% both lines share the same polar axes

Using polarplot with coding agents

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

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

FAQ

Does polarplot store polar data internally?

The line object stores cartesian x/y coordinates after conversion. The axes metadata records that the axes are polar, which controls grid rendering and equal aspect behavior.

Are advanced MATLAB polar axes properties supported?

The initial implementation supports the common plotting forms, line styles, and polar grid rendering. Advanced axes properties such as ThetaLim, RLim, ThetaDir, and ThetaZeroLocation are not yet separate builtins/properties.

2D Charts

area · bar · errorbar · heatmap · hist · histogram · loglog · pie · plot · scatter · semilogx · semilogy · stairs · stem

3D & Surface

contour · contour3 · contourf · mesh · meshc · plot3 · quiver · scatter3 · surf · surfc

Images

image · imagesc · imshow

Axes & Layout

axis · box · grid · sgtitle · subplot · title · view · zlabel

Appearance

colorbar · colormap · legend · shading

Handle Access

gca · gcf · get · set

Other

cla · clf · figure · fill3 · hold · patch · print · suptitle · xline · yline

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.