简体   繁体   English

在Matlab中排除时间序列图中的日期间隔

[英]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. 我的时间序列在上午8点至下午4点之间有每秒的报价,但跳过了晚上和周末。 How can I omit these gaps from my plot such that each day's price series appears to be "glued" together. 我该如何从情节中忽略这些差距,以使每天的价格系列似乎被“粘合”在一起。

ANSWERED: 回答:

Thanks, @Shai! 谢谢@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. 您可以控制绘图的XTick来隐藏间隙。 See this doc . 请参阅此文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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