Main Content

rticks

Set or queryr-axis tick values

Description

example

rticks(ticks)sets ther-axis蜱虫的价值观, which are the locations along ther-axis where the tick marks and grid lines appear. Specifyticksas a vector of increasing values; for example,[0 2 4 6]. This command affects the current axes.

rt= rticksreturns the currentr-axis tick values as a vector.

example

rticks('auto')sets an automatic mode, enabling the axes to determine ther-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 ther-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= rticks('mode')returns the currentr-axis tick labels mode, which is either'auto'or“手动”. By default, the mode is automatic unless you specify tick values or change the mode to manual.

example

___= rticks(pax,___)uses the axes objectpaxinstead of the current axes. Specifypaxas the first input argument for any of the previous syntaxes.

Examples

collapse all

Create a polar plot. Display tick marks and grid lines along ther-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. The axes object contains an object of type line.

Display tick marks and grid lines along ther-axis at nonuniform values between 0 and 10. MATLAB® labels the tick marks with the numeric values.

theta = 0:0.01:2*pi; rho = 10*sin(2*theta); polarplot(theta,rho) rticks([0 4 5 6 10])

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

Display tick marks and grid lines along ther-axis at increments of 10, starting from 0 and ending at 50.

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

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

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

polarplot(1:10) rticks([0 5 10])

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

rticks('auto')

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

Create polar axes and return the polar axes objectpax. Ensure thatrticksaffects the polar axes you just created by passingpaxas the first input argument to the function.

pax = polaraxes; rticks(pax,[0 .5 1])

Figure contains an axes object. The axes object is empty.

Remove the tick marks and grid lines along ther-axis by specifying the tick values as an empty array.

polarplot(1:100) rticks([])

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

Input Arguments

collapse all

Tick values, specified as a vector of increasing values. If you do not want tick marks along ther-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 therticklabelsfunction.

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

Output Arguments

collapse all

Current tick values, returned as a vector.

Current mode, returned as one of these values:

  • 'auto'— Axes automatically determines ther-axis tick values.

  • “手动”——轴使用手动指定r-axis tick values.

More About

collapse all

Tick Values

The tick values are the locations along ther-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 therticksfunction. Set the corresponding tick labels using therticklabelsfunction.

Algorithms

Therticksfunction sets and queries several axes properties related to ther-axis tick values.

  • RTick— Property that stores ther-axis tick values.

  • RTickMode— Property that stores ther-axis tick value mode. When you set ther-axis tick values, this property changes to“手动”.

Version History

Introduced in R2016b