From 756ca55bf9ef82afcfd8791a1b47f22eb8c901c0 Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer <jpfeifer@gmx.de> Date: Wed, 26 Feb 2025 14:48:41 +0100 Subject: [PATCH] plot: deal with fractional ticks Closes #59 --- src/@dseries/plot.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/@dseries/plot.m b/src/@dseries/plot.m index d44a72e..4f485f9 100644 --- a/src/@dseries/plot.m +++ b/src/@dseries/plot.m @@ -67,8 +67,12 @@ switch ndseries hh = plot(o.data); end axis tight; - id = get(gca, 'XTick'); - Dates = strings(o.dates(id)); + %remove fractional ticks + ax=gca; + xtick_values = ax.XTick; + integer_indices = fix(xtick_values) == xtick_values; + ax.XTick = xtick_values(integer_indices); + Dates = strings(o.dates(1:sum(integer_indices))); set(gca,'XTickLabel', Dates); case 2 [o0, o1] = align(o, varargin{1}); -- GitLab