polar
(Not recommended) Polar coordinate plot
polar
is not recommended. Use polarplot
instead. For information on updating your code, see Version History.
Description
ln = polar(___)
returns the Line
object used to create the polar plot. Use ln
to modify the polar plot
after it is created. For a list of properties, see Line Properties.
Examples
Create Polar Plot
Create a polar plot using a dashed red line.
theta = 0:0.01:2*pi;
rho = sin(2*theta).*cos(2*theta);
polar(theta,rho,"--r")
Input Arguments
theta
— Angle values
vector | matrix
Angle values, specified as a vector or matrix. Specify the values in radians.
rho
— Radius values
vector | matrix
Radius values, specified as a vector or matrix.
Negative rho
values reflect through the origin, rotating by
pi
(since (theta,rho)
transforms to
(rho*cos(theta),rho*sin(theta))
). If you want different behavior,
you can manipulate rho
prior to plotting. For example, you can set
rho
equal to max(0,rho)
or
abs(rho)
.
LineSpec
— Line style, marker, and color
string scalar | character vector
Line style, marker, and color, specified as a string scalar or character vector containing symbols. The symbols can appear in any order. You do not need to specify all three characteristics (line style, marker, and color). For example, if you omit the line style and specify the marker, then the plot shows only the marker and no line.
Example: "--or"
is a red dashed line with circle markers.
Line Style | Description | Resulting Line |
---|---|---|
"-" | Solid line |
|
"--" | Dashed line |
|
":" | Dotted line |
|
"-." | Dash-dotted line |
|
Marker | Description | Resulting Marker |
---|---|---|
"o" | Circle |
|
"+" | Plus sign |
|
"*" | Asterisk |
|
"." | Point |
|
"x" | Cross |
|
"_" | Horizontal line |
|
"|" | Vertical line |
|
"square" | Square |
|
"diamond" | Diamond |
|
"^" | Upward-pointing triangle |
|
"v" | Downward-pointing triangle |
|
">" | Right-pointing triangle |
|
"<" | Left-pointing triangle |
|
"pentagram" | Pentagram |
|
"hexagram" | Hexagram |
|
Color Name | Short Name | RGB Triplet | Appearance |
---|---|---|---|
"red" | "r" | [1 0 0] |
|
"green" | "g" | [0 1 0] |
|
"blue" | "b" | [0 0 1] |
|
"cyan"
| "c" | [0 1 1] |
|
"magenta" | "m" | [1 0 1] |
|
"yellow" | "y" | [1 1 0] |
|
"black" | "k" | [0 0 0] |
|
"white" | "w" | [1 1 1] |
|
ax
— Target axes
Axes
object
Target axes, specified as an Axes
object. If you do not specify
the axes, MATLAB® plots into the current axes or it creates an Axes
object if one does not exist. polar
does not support plotting into
PolarAxes
objects.
Extended Capabilities
GPU Arrays
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
The polar
function
supports GPU array input with these usage notes and limitations:
This function accepts GPU arrays, but does not run on a GPU.
For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Distributed Arrays
Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™.
Usage notes and limitations:
This function operates on distributed arrays, but executes in the client MATLAB.
For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).
Version History
Introduced before R2006aR2016a: Not recommended
polar
is not recommended. Use polarplot
instead. There are no plans to remove
polar
.
The polarplot
function draws one or more chart lines in a
PolarAxes
object, which has more relevant customization options than the
Axes
object used in polar
. For example, you can
change the units of the polar plot by setting the ThetaAxisUnits
property
of the PolarAxes
object.
This table shows some typical uses of polar
and how to update your
code to use polarplot
instead.
Objective | Not Recommended | Recommended | Differences |
---|---|---|---|
Plot multiple lines on the same axes. |
figure hold on polar(theta1,rho1) ... polar(thetaN,rhoN) |
polarplot(theta1,rho1,...,thetaN,rhoN) |
|
Specify the plot appearance. |
polar(theta,rho,LineSpec) | polarplot(theta,rho,LineSpec) or polarplot(theta,rho,Name,Value) |
|
Specify the target axes. |
polar(ax,__) |
polarplot(pax,__) |
|
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)