Navigation

Operators and Keywords

Function List:

C++ API

: polar (theta, rho)
: polar (theta, rho, fmt)
: polar (cplx)
: polar (cplx, fmt)
: polar (hax, …)
: h = polar (…)

Create a 2-D plot from polar coordinates theta and rho.

If a single complex input cplx is given then the real part is used for theta and the imaginary part is used for rho.

The optional argument fmt specifies the line format in the same way as plot.

If the first argument hax is an axes handle, then plot into this axis, rather than the current axes returned by gca.

The optional return value h is a graphics handle to the created plot.

Implementation Note: The polar axis is drawn using line and text objects encapsulated in an hggroup. The hggroup properties are linked to the original axes object such that altering an appearance property, for example fontname, will update the polar axis. Two new properties are added to the original axes–rtick, ttick–which replace xtick, ytick. The first is a list of tick locations in the radial (rho) direction; The second is a list of tick locations in the angular (theta) direction specified in degrees, i.e., in the range 0–359.

See also: rose, compass, plot.

Demonstration 1

The following code

 clf;
 theta = linspace (0,2*pi,1000);
 rho = sin (7*theta);
 polar (theta, rho);
 title ("polar() plot");

Produces the following figure

Figure 1

Demonstration 2

The following code

 clf;
 theta = linspace (0,2*pi,1000);
 cplx = theta + i*sin (7*theta);
 polar (cplx, "g");
 title ("polar() plot of complex data");

Produces the following figure

Figure 1

Demonstration 3

The following code

 clf;
 theta = linspace (0,2*pi,1000);
 rho = sin (2*theta).*cos (2*theta);
 polar (theta, rho, "--r");
 set (gca, "rtick", 0.1:0.1:0.6, "ttick", 0:20:340);
 title ("polar() plot with finer grid");

Produces the following figure

Figure 1

Demonstration 4

The following code

 clf;
 theta = linspace (0,2*pi,1000);
 rho = sin (2*theta).*cos (2*theta);
 polar (theta, rho, "--b");
 set (gca, "fontsize", 12, "linewidth", 2, "color", [0.8 0.8 0.8]);
 title ("polar() plot with modified axis appearance");

Produces the following figure

Figure 1

Demonstration 5

The following code

 clf;
 theta = linspace (0,8*pi,1000);
 rho = sin (5/4*theta);
 polar (theta, rho);
 set (gca, "rtick", 0.2:0.2:1);
 title ("polar() plot");

Produces the following figure

Figure 1

Package: octave