From f2b4de1d8af957e4e17867356258dbfa44c60f33 Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan@dynare.org>
Date: Tue, 24 Jun 2014 15:51:29 +0200
Subject: [PATCH] reporting: support a different shape for the axis in a graph

---
 doc/dynare.texi                        | 8 +++++++-
 matlab/reports/@graph/graph.m          | 5 ++++-
 matlab/reports/@graph/writeGraphFile.m | 7 ++++++-
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/doc/dynare.texi b/doc/dynare.texi
index 9ad6e91a7e..0b4ea1e45e 100644
--- a/doc/dynare.texi
+++ b/doc/dynare.texi
@@ -11239,7 +11239,7 @@ command. Default: @code{`!'}
 @end defmethod
 
 @anchor{addGraph}
-@defmethod Report addGraph data, graphDirName, graphName, graphSize, height, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, miscTikzAxisOptions, miscTikzPictureOptions, seriesToUse, shade, shadeColor, shadeOpacity, title, width, xlabel, ylabel, xAxisTight, xrange, xTicks, xTickLabels, xTickLabelAnchor, xTickLabelRotation, yAxisTight, yTickLabelFixed, yTickLabelPrecision, yTickLabelZeroFill, yrange, showZeroline, zeroLineColor
+@defmethod Report addGraph axisShape, data, graphDirName, graphName, graphSize, height, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, miscTikzAxisOptions, miscTikzPictureOptions, seriesToUse, shade, shadeColor, shadeOpacity, title, width, xlabel, ylabel, xAxisTight, xrange, xTicks, xTickLabels, xTickLabelAnchor, xTickLabelRotation, yAxisTight, yTickLabelFixed, yTickLabelPrecision, yTickLabelZeroFill, yrange, showZeroline, zeroLineColor
 Adds a @code{Graph} to a @code{Section}.
 @optionshead
 @table @code
@@ -11248,6 +11248,12 @@ Adds a @code{Graph} to a @code{Section}.
 The @code{dseries} that provides the data for the graph. Default:
 @code{none}
 
+@item axisShape, @code{`box'} | @code{`L'}
+The shape the axis should have. @code{`box'} means that there is an axis line
+to the left, right, bottom, and top of the graphed line(s). @code{`L'} means
+that there is an axis to the left and bottom of the graphed line(s). Default:
+@code{`box'}
+
 @item graphDirName, @code{STRING}
 The name of the folder in which to store this figure. Default:
 @code{tmpRepDir}
diff --git a/matlab/reports/@graph/graph.m b/matlab/reports/@graph/graph.m
index d9bab84806..f6d9f65bc2 100644
--- a/matlab/reports/@graph/graph.m
+++ b/matlab/reports/@graph/graph.m
@@ -40,6 +40,8 @@ o.titleFormat = '';
 o.ylabel = '';
 o.xlabel = '';
 
+o.axisShape = 'box';
+
 o.graphDirName = 'tmpRepDir';
 o.graphName = '';
 o.data = '';
@@ -140,7 +142,8 @@ assert(any(strcmp(o.shadeColor, valid_shadeColor)), ['@graph.graph: shadeColor m
         strjoin(valid_shadeColor)]);
 assert(any(strcmp(o.zeroLineColor, valid_shadeColor)), ...
        ['@graph.graph: zeroLineColor must be one of ' strjoin(valid_shadeColor)]);
-
+assert(any(strcmp(o.axisShape, {'box', 'L'})), ['@graph.graph: shadeColor ' ...
+                    'must be one of ''box'' or ''L''']);
 valid_legend_locations = ...
     {'south west','south east','north west','north east','outer north east'};
 assert(any(strcmp(o.legendLocation, valid_legend_locations)), ...
diff --git a/matlab/reports/@graph/writeGraphFile.m b/matlab/reports/@graph/writeGraphFile.m
index 79b8af7457..4832c7943c 100644
--- a/matlab/reports/@graph/writeGraphFile.m
+++ b/matlab/reports/@graph/writeGraphFile.m
@@ -119,9 +119,14 @@ fprintf(fid, ['},\n',...
               'width=%fin,\n'...
               'height=%fin,\n'...
               'scale only axis,\n'...
-              'axis lines=box,\n'...
               'unbounded coords=jump,\n'], o.width, o.height);
 
+if strcmpi(o.axisShape, 'box')
+    fprintf(fid, 'axis lines=box,\n');
+elseif strcmpi(o.axisShape, 'L')
+    fprintf(fid, 'axis x line=bottom,\naxis y line=left,\n');
+end
+
 if ~isempty(o.title{1})
     fprintf(fid, 'title style={align=center');
     if ~isempty(o.titleFormat)
-- 
GitLab