0
votes

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!

1
I don't -- would interleaving my price data with NaN's hide the time gaps?Bobak Digital
The opposite, NaNs create gaps. Did you check with nnz(isnan(data))? Anyways, we need some code that reproduces the issue to be able to help you further.Oleg

1 Answers

1
votes

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