From 0cb0a23ec13587bf2e43c4f85a37ac1cce4eb1b6 Mon Sep 17 00:00:00 2001 From: Houtan Bastani <houtan@dynare.org> Date: Fri, 5 Apr 2013 11:48:56 +0200 Subject: [PATCH] reporting: @graph: add zeroline option --- matlab/reports/@graph/createGraph.m | 7 +++++++ matlab/reports/@graph/graph.m | 3 +++ 2 files changed, 10 insertions(+) diff --git a/matlab/reports/@graph/createGraph.m b/matlab/reports/@graph/createGraph.m index 22ff418f3..4431c63b6 100644 --- a/matlab/reports/@graph/createGraph.m +++ b/matlab/reports/@graph/createGraph.m @@ -101,6 +101,13 @@ end if ~isempty(o.title) title( o.title, 'Interpreter', 'LaTex'); end + +if o.zeroline + a = ylim; + if 0 > a(1) && 0 < a(2) + plot(xlim, [0 0], 'color', 'k', 'LineWidth', 0.25); + end +end drawnow; o.figname = [tempname '.tex']; diff --git a/matlab/reports/@graph/graph.m b/matlab/reports/@graph/graph.m index 076df7d94..d7a763f08 100644 --- a/matlab/reports/@graph/graph.m +++ b/matlab/reports/@graph/graph.m @@ -56,6 +56,8 @@ o.legend_location = 'SouthEast'; o.legend_orientation = 'horizontal'; o.legend_font_size = 8; +o.zeroline = false; + if nargin == 1 assert(isa(varargin{1}, 'graph'),['@graph.graph: with one arg you ' ... 'must pass a graph object']); @@ -90,6 +92,7 @@ assert(ischar(o.figname), '@graph.graph: figname must be a string'); assert(islogical(o.grid), '@graph.graph: grid must be either true or false'); assert(islogical(o.legend), '@graph.graph: legend must be either true or false'); assert(isint(o.legend_font_size), '@graph.graph: legend_font_size must be an integer'); +assert(islogical(o.zeroline), '@graph.graph: zeroline must be either true or false'); valid_legend_locations = ... {'North', 'South', 'East', 'West', ... 'NorthEast', 'SouthEast', 'NorthWest', 'SouthWest', ... -- GitLab