From 3c8164f1016b4d3294f513e66b627bdf24d4f7e2 Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan@dynare.org>
Date: Fri, 3 May 2013 14:39:37 +0200
Subject: [PATCH] reporting: fix xticklabels

---
 matlab/reporting/@graph/createGraph.m | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/matlab/reporting/@graph/createGraph.m b/matlab/reporting/@graph/createGraph.m
index e870d53c0d..d702a8d7d3 100644
--- a/matlab/reporting/@graph/createGraph.m
+++ b/matlab/reporting/@graph/createGraph.m
@@ -95,8 +95,16 @@ if ~isempty(o.shade)
 end
 
 xticks = get(gca, 'XTick');
-[junk, ix, junk] = intersect(x, xticks);
-set(gca, 'XTickLabel', xlabels(ix));
+xTickLabels = cell(1, length(xticks));
+for i=1:length(xticks)
+    if xticks(i) >= x(1) && ...
+            xticks(i) <= x(end)
+        xTickLabels{i} = xlabels{xticks(i)};
+    else
+        xTickLabels{i} = '';
+    end
+end
+set(gca, 'XTickLabel', xTickLabels);
 
 if o.legend
     lh = legend(line_handles, o.seriesElements.getTexNames(), ...
-- 
GitLab