Increasing the Number of Xticks in X-axis of a datetime plot

15 ビュー (過去 30 日間)
Alexander Abadom
Alexander Abadom 2020 年 6 月 26 日
編集済み: Aakash Mehta 2020 年 6 月 26 日
How can i increase the number of Xticks on the X-axis from 6 to like 10?
I tried to edit the 'Plot axis' but the X-axis is 'Disabled'
% Read data sets for current1, voltage1, radiation1,time;
figure(1)
time = datetime(time2,'InputFormat','MM/dd/yyyy HH:mm:ss:SSS',...
'Format','dd/MM/yyyy HH:mm:ss.SSS');
[voltage1]=modeldata.LSCVoltage;
plot(time,voltage1,"r-.");
title ('Electrical performance3');
xlabel ('TimeOfDay','FontWeight','bold','FontName','Arial');
ylabel ('Voltage','FontWeight','bold','FontName','Arial');

回答 (1 件)

Aakash Mehta
Aakash Mehta 2020 年 6 月 26 日
編集済み: Aakash Mehta 2020 年 6 月 26 日
You can set X-axis ticks values using 'xticks'
Refer to xticks help.
As per my understanding you need xticks from 6 to 10. Try below code.
xticks(6:1:10)
Here, I assumed that the difference between two succesive ticks is 1.

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by