Axes tick Labels

Just as we changed the tick values in the above example, we can change the labels given to those ticks as well using the following functions.

Syntax:

rticklabels(<labels>)

thetaticklabels(<labels>)

We will now plot the trigonometric identity sin2(r) + cos2(r) = 1, in polar frames with only the 4 directions on the theta axis.

Example 3:

Matlab




% MATLAB code for Axes tick Labels
ax=polaraxes;
r=linspace(-pi,pi);
 
% Plotting the identity
plot(ax,r,sin(r).^2+cos(r).^2)
rticks([0 .23 .5 1 ])
 
% Setting r tick labels
rticklabels(["a=0","b=.23","c=.5","d=1"])
thetaticks([0 90 180 270])
 
% Setting theta tick labels
thetaticklabels(["East","North","West","South"])


Output:

 

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 axes in MATLAB:

  1. Axes limits
  2. Axes ticks
  3. Axes tick labels
  4. R-axis tick angle

Let us see each of these with an example each.

Similar Reads

Axes Limits:

MATLAB provides us with options to change the limits of r and theta axis by using the rlim() and thetalim() functions....

Axes Ticks:

...

Axes tick Labels:

We can change where the ticks are marked on r and theta axes using the following functions....

R-Axis Tick Angles:

...