Current date being plotted on graph with time data

1 view (last 30 days)
S1_NB = Data(Data.RoadSection=='High St to Highbury',:);
figure(1)
fig1 = figure(1);
left_color = [0 0 0];
right_color = [0 0 0];
set(fig1,'defaultAxesColorOrder',[left_color; right_color])
title('Segment 1: Northbound')
yyaxis left
plot(S1_NB.Time,S1_NB.AvgTT,'-r')
xlim([S1_NB.Time(1),S1_NB.Time(end)])
ylim([60 135])
grid on
xlabel('Time of Day')
ylabel('Travel Time (seconds)')
hold on
plot(S1_NB.Time,S1_NB.FreeTT)
yyaxis right
plot(S1_NB.Time,S1_NB.No_Vehicles)
ylabel('Number of Vehicles')
Plotting some data against time data, the format is in 'hh:mm:ss aa' but all my figures have a singular date stamp of todays date on the x axis.
  9 Comments
Walter Roberson
Walter Roberson on 16 Oct 2021
[H,M,S] = hms(Data.Time);
Data.Time = duration(H, M, S);
After that, Data.Time should plot without the date component.

Sign in to comment.

Answers (0)

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!