简体   繁体   中英

Exclude Date Gaps in Time Series Plot in Matlab

I'm making a time series plot of high frequency price data. My time series has quotes for each second between 8am and 4pm but skips evenings and weekends. How can I omit these gaps from my plot such that each day's price series appears to be "glued" together.

ANSWERED:

Thanks, @Shai! I went with something like this:

% price, year, month, day, hour, minute, second are all column vectors of equal length
% exactly N price quotes per trading day (8am-4pm, excluding weekends)
date = datenum([year, month, day, hour, minute, second]);
price = price;
figure;
plot(price);
tick_index = 1:N:length(date); % my ticks are placed at the start of each trading day
tick_label = datestr(date(tick_index), 6);
set(gca, 'XTick', tick_index);
set(gca, 'XTickLabel', tick_label);

I'm very new to answering questions -- if I've violated etiquette please let me know!

You can control the XTick s of your plot to hide the gaps. See this doc .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM