rticks - Set or query r-axis tick values - MATLAB (original) (raw)
Set or query _r_-axis tick values
Syntax
Description
rticks([ticks](#bvawrh%5F-1-ticks))
sets the _r_-axis tick values, which are the locations along the _r_-axis where the tick marks and grid lines appear. Specify ticks
as a vector of increasing values; for example, [0 2 4 6]
. This command affects the current axes.
[rt](#bvawrh%5F-1-rt) = rticks
returns the current _r_-axis tick values as a vector.
rticks('auto')
sets an automatic mode, enabling the axes to determine the _r_-axis tick values. Use this option if you change the tick values and then want to set them back to the default values.
rticks('manual')
sets a manual mode, freezing the _r_-axis tick values at the current values. Use this option if you want to retain the current tick values when resizing the axes or adding new data to the axes.
[m](#bvawrh%5F-1-m) = rticks('mode')
returns the current _r_-axis tick labels mode, which is either 'auto'
or 'manual'
. By default, the mode is automatic unless you specify tick values or change the mode to manual.
___ = rticks([pax](#bvawrh%5F-1-pax),___)
uses the axes object pax
instead of the current axes. Specify pax
as the first input argument for any of the previous syntaxes.
Examples
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'})
Display tick marks and grid lines along the _r_-axis at nonuniform values between 0 and 10. MATLAB® labels the tick marks with the numeric values.
theta = 0:0.01:2pi; rho = 10sin(2*theta); polarplot(theta,rho) rticks([0 4 5 6 10])
Display tick marks and grid lines along the _r_-axis at increments of 10, starting from 0 and ending at 50.
theta = 0:0.01:2pi; rho = 50sin(2*theta); polarplot(theta,rho) rticks(0:10:50)
Create a polar plot and specify the _r_-axis tick values. Then, set the _r_-axis tick values back to the default values.
polarplot(1:10) rticks([0 5 10])
Create polar axes and return the polar axes object pax
. Ensure that rticks
affects the polar axes you just created by passing pax
as the first input argument to the function.
pax = polaraxes; rticks(pax,[0 .5 1])
Remove the tick marks and grid lines along the _r_-axis by specifying the tick values as an empty array.
polarplot(1:100) rticks([])
Input Arguments
Tick values, specified as a vector of increasing values. If you do not want tick marks along the _r_-axis, specify an empty vector []
.
Example: rticks([0 1 2 3 4])
Example: rticks(0:10:100)
Example: rticks([])
Note
To specify the tick labels, use the rticklabels function.
Polar axes, or an array of polar axes. If you do not specify this argument, then rticks
modifies the current axes (provided that the current axes is a polar axes object).
Output Arguments
Current tick values, returned as a vector.
Current mode, returned as one of these values:
'auto'
— Axes automatically determines the _r_-axis tick values.'manual'
— Axes uses manually specified _r_-axis tick values.
More About
The tick values are the locations along the _r_-axis where the tick marks appear. The tick labels are the labels that you see next to each tick mark. Set the tick values using the rticks
function. Set the corresponding tick labels using the rticklabels function.
Algorithms
The rticks
function sets and queries several axes properties related to the _r_-axis tick values.
- RTick — Property that stores the _r_-axis tick values.
- RTickMode — Property that stores the _r_-axis tick value mode. When you set the _r_-axis tick values, this property changes to
'manual'
.
Version History
Introduced in R2016b