133 / 5.000 Resultados de traducción Hello everyone, I want to know how the values of the X axis and Y axis can be further divided. I want the values on the x axis to be by ye

1 次查看(过去 30 天)
133 / 5.000
Resultados de traducción
star_border
Hello everyone, I want to know how the values of the X axis and Y axis can be further divided. I want the values on the x axis to be by years.

回答(1 个)

Saarthak Gupta
Saarthak Gupta 2023-9-12
编辑:Saarthak Gupta 2023-9-12
I understand you are trying to provide custom tick values for the x-axis of your plot. You need to use the ‘xticks’ function for the plot to achieve the desired result.
Please refer to the following example:
x=1:100;
y=x.^2;
plot(x,y);
The ticks are separated by 20 units. To plot the ticks 10 units apart (or at any other distance for that matter), you can do the following:
x=1:100;
y=x.^2;
plot(x,y);
xticks(0:10:100);
The ‘xticks’ function creates 10 ticks, spaced 10 units apart, in the x-axis. You can specify any other set of ticks as a row/column vector, which can be supplied as input to the ‘xticks’ function.
Please refer to the following MATLAB documentation for more details:

类别

Help CenterFile Exchange 中查找有关 Grid Lines, Tick Values, and Labels 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by