Can't add more x-axis ticks or number of x-axis elements displayed.
2 views (last 30 days)
Show older comments
TimeCol=datenum(Sheet.Time);
TimeCol=Sheet1.Time/(24*3600);
TimeCol=datevec(TimeCol);
TimeCol=datetime(TimeCol);
plot(TimeCol,Value)
This results in an x-axis from 07:00 to 09:00 (hh:mm) in increments of 00:30, and I can't find a way to either add ticks every 15 minutes nor change the number of times displayed.
0 Comments
Accepted Answer
Voss
on 24 Aug 2023
First, I'll try to reproduce something like your plot:
TimeCol=datetime(datevec(now()+seconds(1800*(0:4))));
Value = rand(1,5);
figure
plot(TimeCol,Value)
Now, I'll plot the same thing, but I'll adjust the x-ticks by setting the increment to 15 minutes:
figure
plot(TimeCol,Value)
xt = xticks();
xt = xt(1):duration(minutes(15)):xt(end);
xticks(xt);
Another identical plot, but this time specify that there must be 10 x-ticks:
figure
plot(TimeCol,Value)
xt = xticks();
xt = linspace(xt(1),xt(end),10);
xticks(xt);
0 Comments
More Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots 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!