Create Polar Axes in MATLAB
Last Updated :
23 Jul, 2025
Polar Axes/Coordinate system is a type of coordinate system which rather than using the traditional cartesian axes with X and Y axes uses polar coordinates, which consists of a magnitude vector (r) and its corresponding angle (\theta ). The conversion from polar to cartesian coordinate is simple and the same is given below:
x = r \times \cos{\theta}\\ y = r \times \sin{\theta}
In this article, we shall see how to create Polar Axes in MATLAB and shall explore various options available with the same.
Creating Polar Axes
MATLAB provides a built-in function to create polar axes, the polaraxes function. By default, this creates a new figure component and creates an empty set of polar axes in it. Its syntax is:
pax = polaraxes(<optional arguments>)
The polaraxes function has no default parameters but, only a few optional parameters which we shall explore in later sections. Now, let us see the usage of the same with the help of some examples.
Example 1
In this example, we shall create an empty set of polar axes using the polaraxes function.
Matlab
This will only create a set of polaraxes without any plots in it. Its output will be:
Output:
Example 2
In this example, we shall create a polar plot in the polar axes made in the previous example. To create a polar we use the polarplot function of MATLAB.
Syntax:
polarplot(axes, theta, r)
Here,
axes -> Name of polar axes
theta -> Range of angle coordinate
r -> Magnitude of the vector
We shall create a pattern of 3 petals using the mathematical relation
r = a\ \cos{(n\times\theta)}
Where a defined the radius of the nodes and n defines the number of nodes/petals created.
Matlab
% creating a uifigure component
fig = uifigure;
% creating a set of polar axes in figure fig
ax1 = polaraxes(fig);
% defining the range of angle coordinate
theta=0:.01:2*pi;
% using the relation to plot 3 petals
r= cos(3*theta);
% plotting the graph
polarplot(ax1,theta,r)
This will create 3 petals with each of radius 1 unit.
Output:
Example 3
Making the Polar Axes the default axes
In the previous example, we saw that we had to specify the polar axes in which we have to plot the polar plot. This is syntactical in MATLAB as it needs a value for the polar axes object. However, there is an option provided by MATLAB which allows you to set particular polar axes as default for following plots, which saves the programmer from the recursive mentioning of the polar axes.
Matlab
ax1 = polaraxes;
% making ax1 the default polaraxes
polaraxes(ax1)
%creating data for 2 different polar plots
theta=0:.01:2*pi;
r1= cos(3*theta);
r2 = 1.23*sin(3*theta);
%using hold command to plt multiple plots in same plot
hold on
polarplot(theta,r1)
polarplot(theta,r2)
In this example, we use polaraxes(ax1) form of the polar axes function which makes it the default axes for further polar plots. Next, we plot two petal functions to explain that once the default plot is set, there is no requirement to mention the polar axes name every time you plot some function in polar form.
The output of the above code is given below:
Conclusion
This article explained how to create Polar Axes in MATLAB and some options available with the same. For more modifications and an understanding of Polar Plot behavior in MATLAB, see changing the appearance and behaviors of Polar Axes.
Similar Reads
Create Cartesian Axes in MATLAB By default, the cartesian axes are added to a figure in MATLAB when it is created as a graphical component however, MATLAB provides a function to do the particular job, the axes() function. This function creates cartesian axes in a figure. It is highly useful in cases where multiple cartesian planes
3 min read
Polar Axes Appearance and Behavior in MATLAB Polar axes are coordinate axes where the two coordinate axes are r-axis for magnitude and theta-axis for angles. MATLAB has many functions to change the properties of these polar axes which we shall see throughout this article. In this article we shall see how to modify following properties of polar
3 min read
Formatting Axes in Python-Matplotlib Matplotlib is a python library for creating static, animated and interactive data visualizations. Note: For more information, refer to Introduction to Matplotlib What is Axes? This is what you think of as 'plot'. It is the region of the image that contains the data space. The Axes contains two or th
4 min read
Add Legend to Axes in MATLAB MATLAB provides the legend() function to add legends to a set of axes, which makes legend-making easy and efficient. In this article, we shall see how to add legends to single and multiple cartesian axes in MATLAB with various examples. Syntax:plot(...) legend ('label1', 'label2', ..., 'label_N') No
2 min read
MATLAB - Plots in Detail Prerequisite: Introduction to MATLABMATLAB is a powerful programming language, that can be used to draw various plots used in machine learning, deep learning, computer vision, and big data programming. Let us start with coding for plots in MATLAB. Example 1: Let us first understand the simple plot
2 min read
Plot Expression or Function in MATLAB In this article, we will discuss how to plot expressions or functions in MATLAB. We can make use fplot() function in MATLAB to generate the plot corresponding to an expression or function. There are different variants of fplot() function fplot(f)fplot(f,xinterval)fplot(___,LineSpec)fplot(___,Name,Va
3 min read