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 view (last 30 days)
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.

Answers (1)

Saarthak Gupta
Saarthak Gupta on 12 Sep 2023
Edited: Saarthak Gupta on 12 Sep 2023
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:

Tags

Community Treasure Hunt

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

Start Hunting!