Labelling of x axis
1 view (last 30 days)
Show older comments
Telema Harry on 31 May 2021
Commented: Telema Harry on 9 Jun 2021
I have an hourly data and I used a step size of 0.1 in my simulation.
I used 12 hours worth of data in my simulation.
I will like the x-axis of my graph to be in hours stead of the number of points.
please how can I do that?
Constantino Carlos Reyes-Aldasoro on 31 May 2021
There are 2 ways to solve this:
First is to plot in the actual hours instead of the points of the matrix that is holding the data, so, say your values are stored every second, instead of plotting
you should plot
and that would adjust the values of the x-axis.
The second way is to manipulate the values that are displayed on the x-axis, these are called the ticks and tick labels, for example:
>> h1=gca; %you are grabbing the handles of the axis
Columns 1 through 7
0 2 4 6 8 10 12
Columns 8 through 11
14 16 18 20
11×1 cell array
So you can change the values of XTickLabel. I would suggest to try the first method and see if that works.
Hope this solves your problem.
More Answers (0)
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!