rticklabels - Set or query r-axis tick labels - MATLAB (original) (raw)

Set or query _r_-axis tick labels

Syntax

Description

rticklabels([labels](#bvayrux-1-labels)) sets the_r_-axis tick labels for the current axes. Specifylabels as a string array or a cell array of character vectors; for example, {'January','February','March'}. If you specify the labels, then the _r_-axis tick values and tick labels no longer update automatically based on changes to the axes.

example

[rl](#bvayrux-1-rl) = rticklabels returns the _r_-axis tick labels for the current axes.

rticklabels('auto') sets an automatic mode, enabling the axes to determine the _r_-axis tick labels. Use this option if you set the labels and then want to set them back to the default values.

example

rticklabels('manual') sets a manual mode, freezing the _r_-axis tick labels at the current values.

[m](#bvayrux-1-m) = rticklabels('mode') returns the current value of the _r_-axis tick labels mode, which is either 'auto' or 'manual'. By default, the mode is automatic unless you specify the tick labels or set the mode to manual.

___ = rticklabels([pax](#bvayrux-1-pax),___) uses the axes specified by pax instead of the current axes. Specify ax as the first input argument for any of the previous syntaxes.

example

Examples

collapse all

Create a polar plot. Display tick marks and grid lines along the _r_-axis at the values 0.1, 0.3, and 0.5. Then, specify a label for each tick mark.

theta = linspace(0,2*pi); rho = theta/10; polarplot(theta,rho) rticks([0.1 0.25 0.5]) rticklabels({'r = .1','r = .3','r = .5'})

Figure contains an axes object with type polaraxes. The polaraxes object contains an object of type line.

Create a polar plot and assign the polar axes object to the variable pax. Ensure that rticks and rticklabels affect the polar axes you just created by specifying pax as the first input argument to the functions.

theta = 0:0.01:2pi; rho = 50sin(2*theta); polarplot(theta,rho) pax = gca;

rticks(pax,[10 25 50]) rticklabels(pax,{'r = 10','r = 25','r = 50'})

Figure contains an axes object with type polaraxes. The polaraxes object contains an object of type line.

Create a polar plot and specify the _r_-axis tick values and corresponding labels. Then, set the _r_-axis tick values and labels back to the default values.

theta = linspace(0,2*pi); rho = theta/10; polarplot(theta,rho) rticks([0.1 0.25 0.5]) rticklabels({'r = .1','r = .3','r = .5'})

Figure contains an axes object with type polaraxes. The polaraxes object contains an object of type line.

rticks('auto') rticklabels('auto')

Figure contains an axes object with type polaraxes. The polaraxes object contains an object of type line.

Remove the tick labels along the _r_-axis by specifying the tick labels as an empty array.

theta = 0:0.01:2pi; rho = 50sin(2*theta); polarplot(theta,rho) rticklabels({})

Figure contains an axes object with type polaraxes. The polaraxes object contains an object of type line.

Input Arguments

collapse all

Tick labels, specified as a cell array of character vectors, string array, or categorical array. If you do not want tick labels to show, then specify an empty cell array {}. Tick labels support TeX and LaTeX markup. See the TickLabelInterpreter property of the axes object for more information.

Example: rticklabels({'0','\pi','2\pi'})

Example: rticklabels({'January','Febrary','March'})

Example: rticklabels({})

Note

Polar axes, or an array of polar axes. If you do not specify this argument, then rticklabels modifies the current axes (provided that the current axes is a polar axes object).

Output Arguments

collapse all

Current tick labels, returned as a cell array of character vectors or a character array.

Current tick labels mode, returned as one of these values:

More About

collapse all

The tick labels are the labels that you see next to each tick mark. The tick values are the locations along the _r_-axis where the tick marks appear. Set the tick values using the rticks function. Set the corresponding tick labels using the rticklabels function.

Tick marks appear as circular lines along the r-axis. Tick labels for tick values appear as text directly on each tick mark line.

Algorithms

The rticklabels function sets and queries several polar axes properties related to the _r_-axis tick labels.

Version History

Introduced in R2016b