diff --git a/src/@graph/addSeries.m b/src/@report_graph/addSeries.m similarity index 90% rename from src/@graph/addSeries.m rename to src/@report_graph/addSeries.m index 8a567e4e74de8ba0d025f85e8313dcc96e5e0a27..adf157b8b05504886b2489574a342de190d701b1 100644 --- a/src/@graph/addSeries.m +++ b/src/@report_graph/addSeries.m @@ -3,7 +3,7 @@ function o = addSeries(o, varargin) % Add a series % % INPUTS -% o [graph] graph object +% o [report_graph] report_graph object % varargin arguments to report_series() % % OUTPUTS @@ -12,7 +12,7 @@ function o = addSeries(o, varargin) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2013-2019 Dynare Team +% Copyright (C) 2013-2020 Dynare Team % % This file is part of Dynare. % @@ -30,4 +30,4 @@ function o = addSeries(o, varargin) % along with Dynare. If not, see <http://www.gnu.org/licenses/>. o.series{end+1} = report_series(varargin{:}); -end \ No newline at end of file +end diff --git a/src/@graph/end.m b/src/@report_graph/end.m similarity index 85% rename from src/@graph/end.m rename to src/@report_graph/end.m index 55c7bcd88fe879f30fcac4327dcdb94e0f8899df..2410bc9165c90715c6fdf53b9c3f58ab372626c8 100644 --- a/src/@graph/end.m +++ b/src/@report_graph/end.m @@ -3,7 +3,7 @@ function lastIndex = end(o, k, n) % End keyword % % INPUTS -% o [graph] graph object +% o [report_graph] report_graph object % k [integer] index where end appears % n [integer] number of indices % @@ -13,7 +13,7 @@ function lastIndex = end(o, k, n) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2013-2015 Dynare Team +% Copyright (C) 2013-2020 Dynare Team % % This file is part of Dynare. % @@ -30,6 +30,6 @@ function lastIndex = end(o, k, n) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <http://www.gnu.org/licenses/>. -assert(k==1 && n==1, '@graph/end: graph only has one dimension'); +assert(k==1 && n==1, '@report_graph/end: graph only has one dimension'); lastIndex = length(o.series); -end \ No newline at end of file +end diff --git a/src/@graph/graph.m b/src/@report_graph/report_graph.m similarity index 68% rename from src/@graph/graph.m rename to src/@report_graph/report_graph.m index 01e163b0c3f7b3da3aa5732e34fe2d024b6e4daf..9739cb489fc3336a6952eb1461223a2396ec5b21 100644 --- a/src/@graph/graph.m +++ b/src/@report_graph/report_graph.m @@ -1,7 +1,7 @@ -classdef graph < handle - % graph Class +classdef report_graph < handle + % report_graph Class % - % Copyright (C) 2013-2019 Dynare Team + % Copyright (C) 2013-2020 Dynare Team % % This file is part of Dynare. % @@ -63,31 +63,31 @@ classdef graph < handle writeCSV = false % Whether or not to write a CSV file with only the plotted data. The file will be saved in the directory specified by graphDirName with the same base name as specified by graphName with the ending .csv. Default: false. end methods - function o = graph(varargin) - %function o = graph(varargin) - % Graph Class Constructor + function o = report_graph(varargin) + %function o = report_graph(varargin) + % report_graph class constructor % % INPUTS - % varargin 0 args : empty graph object - % 1 arg : must be graph object (return a copy of arg) + % varargin 0 args : empty report_graph object + % 1 arg : must be report_graph object (return a copy of arg) % > 1 args: option/value pairs (see structure below for % options) % % OUTPUTS - % o [graph] graph object + % o [report_graph] report_graph object % % SPECIAL REQUIREMENTS % none if nargin == 0 return elseif nargin == 1 - assert(isa(varargin{1}, 'graph'), ... - 'With one arg to the Graph constructor, you must pass a graph object'); + assert(isa(varargin{1}, 'report_graph'), ... + 'With one arg to the report_graph constructor, you must pass a report_graph object'); o = varargin{1}; return elseif nargin > 1 if round(nargin/2) ~= nargin/2 - error('@graph.graph: options must be supplied in name/value pairs.'); + error('@report_graph.report_graph: options must be supplied in name/value pairs.'); end % Octave 5.1.0 has not implemented `properties` and issues a warning when using `fieldnames` @@ -102,7 +102,7 @@ classdef graph < handle if ~isempty(ind) o.(optNames{ind}) = pair{2}; else - error('@graph.graph: %s is not a recognized option.', pair{1}); + error('@report_graph.report_graph: %s is not a recognized option.', pair{1}); end end end @@ -111,82 +111,82 @@ classdef graph < handle if ischar(o.title) o.title = {o.title}; end - assert(iscellstr(o.title), '@graph.graph: title must be a cell array of string(s)'); - assert(ischar(o.titleFormat), '@graph.graph: titleFormat file must be a string'); - assert(ischar(o.xlabel), '@graph.graph: xlabel file must be a string'); - assert(ischar(o.ylabel), '@graph.graph: ylabel file must be a string'); - assert(ischar(o.miscTikzPictureOptions), '@graph.graph: miscTikzPictureOptions file must be a string'); - assert(ischar(o.miscTikzAxisOptions), '@graph.graph: miscTikzAxisOptions file must be a string'); - assert(ischar(o.graphName), '@graph.graph: graphName must be a string'); - assert(ischar(o.graphDirName), '@graph.graph: graphDirName must be a string'); - assert(islogical(o.showGrid), '@graph.graph: showGrid must be either true or false'); - assert(islogical(o.xAxisTight), '@graph.graph: xAxisTight must be either true or false'); - assert(islogical(o.yAxisTight), '@graph.graph: yAxisTight must be either true or false'); - assert(islogical(o.showLegend), '@graph.graph: showLegend must be either true or false'); + assert(iscellstr(o.title), '@report_graph.report_graph: title must be a cell array of string(s)'); + assert(ischar(o.titleFormat), '@report_graph.report_graph: titleFormat file must be a string'); + assert(ischar(o.xlabel), '@report_graph.report_graph: xlabel file must be a string'); + assert(ischar(o.ylabel), '@report_graph.report_graph: ylabel file must be a string'); + assert(ischar(o.miscTikzPictureOptions), '@report_graph.report_graph: miscTikzPictureOptions file must be a string'); + assert(ischar(o.miscTikzAxisOptions), '@report_graph.report_graph: miscTikzAxisOptions file must be a string'); + assert(ischar(o.graphName), '@report_graph.report_graph: graphName must be a string'); + assert(ischar(o.graphDirName), '@report_graph.report_graph: graphDirName must be a string'); + assert(islogical(o.showGrid), '@report_graph.report_graph: showGrid must be either true or false'); + assert(islogical(o.xAxisTight), '@report_graph.report_graph: xAxisTight must be either true or false'); + assert(islogical(o.yAxisTight), '@report_graph.report_graph: yAxisTight must be either true or false'); + assert(islogical(o.showLegend), '@report_graph.report_graph: showLegend must be either true or false'); assert(isempty(o.legendAt) || (isfloat(o.legendAt) && length(o.legendAt)==2), ... - '@graph.graph: legendAt must be a double array of size two'); - assert(islogical(o.showLegendBox), '@graph.graph: showLegendBox must be either true or false'); - assert(islogical(o.showZeroline), '@graph.graph: showZeroline must be either true or false'); + '@report_graph.report_graph: legendAt must be a double array of size two'); + assert(islogical(o.showLegendBox), '@report_graph.report_graph: showLegendBox must be either true or false'); + assert(islogical(o.showZeroline), '@report_graph.report_graph: showZeroline must be either true or false'); assert(isfloat(o.shadeOpacity) && length(o.shadeOpacity)==1 && ... o.shadeOpacity >= 0 && o.shadeOpacity <= 100, ... - '@graph.graph: o.shadeOpacity must be a real in [0 100]'); - assert(isfloat(o.width), '@graph.graph: o.width must be a real number'); - assert(isfloat(o.height), '@graph.graph: o.height must be a real number'); - assert(isfloat(o.xTickLabelRotation), '@graph.graph: o.xTickLabelRotation must be a real number'); - assert(ischar(o.xTickLabelAnchor), '@graph.graph: xTickLabelAnchor must be a string'); - assert(isint(o.yTickLabelPrecision), '@graph.graph: o.yTickLabelPrecision must be an integer'); - assert(islogical(o.yTickLabelFixed), '@graph.graph: yTickLabelFixed must be either true or false'); - assert(islogical(o.yTickLabelZeroFill), '@graph.graph: yTickLabelZeroFill must be either true or false'); - assert(islogical(o.yTickLabelScaled), '@graph.graph: yTickLabelScaled must be either true or false'); - assert(islogical(o.writeCSV), '@graph.graph: writeCSV must be either true or false'); - assert(ischar(o.shadeColor), '@graph.graph: shadeColor must be a string'); - assert(ischar(o.zeroLineColor), '@graph.graph: zeroLineColor must be a string'); - assert(any(strcmp(o.axisShape, {'box', 'L'})), ['@graph.graph: axisShape ' ... + '@report_graph.report_graph: o.shadeOpacity must be a real in [0 100]'); + assert(isfloat(o.width), '@report_graph.report_graph: o.width must be a real number'); + assert(isfloat(o.height), '@report_graph.report_graph: o.height must be a real number'); + assert(isfloat(o.xTickLabelRotation), '@report_graph.report_graph: o.xTickLabelRotation must be a real number'); + assert(ischar(o.xTickLabelAnchor), '@report_graph.report_graph: xTickLabelAnchor must be a string'); + assert(isint(o.yTickLabelPrecision), '@report_graph.report_graph: o.yTickLabelPrecision must be an integer'); + assert(islogical(o.yTickLabelFixed), '@report_graph.report_graph: yTickLabelFixed must be either true or false'); + assert(islogical(o.yTickLabelZeroFill), '@report_graph.report_graph: yTickLabelZeroFill must be either true or false'); + assert(islogical(o.yTickLabelScaled), '@report_graph.report_graph: yTickLabelScaled must be either true or false'); + assert(islogical(o.writeCSV), '@report_graph.report_graph: writeCSV must be either true or false'); + assert(ischar(o.shadeColor), '@report_graph.report_graph: shadeColor must be a string'); + assert(ischar(o.zeroLineColor), '@report_graph.report_graph: zeroLineColor must be a string'); + assert(any(strcmp(o.axisShape, {'box', 'L'})), ['@report_graph.report_graph: axisShape ' ... '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)), ... - ['@graph.graph: legendLocation must be one of ' addCommasToCellStr(valid_legend_locations)]); + ['@report_graph.report_graph: legendLocation must be one of ' addCommasToCellStr(valid_legend_locations)]); valid_font_sizes = {'tiny', 'scriptsize', 'footnotesize', 'small', ... 'normalsize', 'large', 'Large', 'LARGE', 'huge', 'Huge'}; assert(any(strcmp(o.legendFontSize, valid_font_sizes)), ... - ['@graph.graph: legendFontSize must be one of ' addCommasToCellStr(valid_font_sizes)]); + ['@report_graph.report_graph: legendFontSize must be one of ' addCommasToCellStr(valid_font_sizes)]); assert(any(strcmp(o.titleFontSize, valid_font_sizes)), ... - ['@graph.graph: titleFontSize must be one of ' addCommasToCellStr(valid_font_sizes)]); + ['@report_graph.report_graph: titleFontSize must be one of ' addCommasToCellStr(valid_font_sizes)]); assert(any(strcmp(o.tickFontSize, valid_font_sizes)), ... - ['@graph.graph: tickFontSize must be one of ' addCommasToCellStr(valid_font_sizes)]); + ['@report_graph.report_graph: tickFontSize must be one of ' addCommasToCellStr(valid_font_sizes)]); valid_legend_orientations = {'vertical', 'horizontal'}; assert(any(strcmp(o.legendOrientation, valid_legend_orientations)), ... - ['@graph.graph: legendOrientation must be one of ' addCommasToCellStr(valid_legend_orientations)]); + ['@report_graph.report_graph: legendOrientation must be one of ' addCommasToCellStr(valid_legend_orientations)]); assert(isempty(o.shade) || (isdates(o.shade) && o.shade.ndat >= 2), ... - ['@graph.graph: shade is specified as a dates range, e.g. ' ... + ['@report_graph.report_graph: shade is specified as a dates range, e.g. ' ... '''dates(''1999q1''):dates(''1999q3'')''.']); assert(isempty(o.xrange) || (isdates(o.xrange) && o.xrange.ndat >= 2), ... - ['@graph.graph: xrange is specified as a dates range, e.g. ' ... + ['@report_graph.report_graph: xrange is specified as a dates range, e.g. ' ... '''dates(''1999q1''):dates(''1999q3'')''.']); assert(isempty(o.yrange) || (isfloat(o.yrange) && length(o.yrange) == 2 && ... o.yrange(1) < o.yrange(2)), ... - ['@graph.graph: yrange is specified an array with two float entries, ' ... + ['@report_graph.report_graph: yrange is specified an array with two float entries, ' ... 'the lower bound and upper bound.']); - assert(isempty(o.data) || isdseries(o.data), ['@graph.graph: data must ' ... + assert(isempty(o.data) || isdseries(o.data), ['@report_graph.report_graph: data must ' ... 'be a dseries']); - assert(isempty(o.seriesToUse) || iscellstr(o.seriesToUse), ['@graph.graph: ' ... + assert(isempty(o.seriesToUse) || iscellstr(o.seriesToUse), ['@report_graph.report_graph: ' ... 'seriesToUse must be a cell array of string(s)']); assert(isempty(o.xTicks) || isfloat(o.xTicks),... - '@graph.graph: xTicks must be a numerical array'); + '@report_graph.report_graph: xTicks must be a numerical array'); assert(iscellstr(o.xTickLabels) || (ischar(o.xTickLabels) && strcmpi(o.xTickLabels, 'ALL')), ... - ['@graph.graph: xTickLabels must be a cell array of strings or ' ... + ['@report_graph.report_graph: xTickLabels must be a cell array of strings or ' ... 'equivalent to the string ''ALL''']); if ~isempty(o.xTickLabels) assert((ischar(o.xTickLabels) && strcmpi(o.xTickLabels, 'ALL')) || ... - ~isempty(o.xTicks), ['@graph.graph: if you set xTickLabels and ' ... + ~isempty(o.xTicks), ['@report_graph.report_graph: if you set xTickLabels and ' ... 'it''s not equal to ''ALL'', you must set xTicks']); end if ~isempty(o.xTicks) - assert(~isempty(o.xTickLabels), '@graph.graph: if you set xTicks, you must set xTickLabels'); + assert(~isempty(o.xTickLabels), '@report_graph.report_graph: if you set xTicks, you must set xTickLabels'); end % using o.seriesToUse, create series objects and put them in o.series diff --git a/src/@graph/write.m b/src/@report_graph/write.m similarity index 87% rename from src/@graph/write.m rename to src/@report_graph/write.m index 0cf707b59cbe71e6012c4f79830fbc645ca0b0a3..069bc77a2c3edcb1b359f44a2681082f8d51d8e5 100644 --- a/src/@graph/write.m +++ b/src/@report_graph/write.m @@ -1,9 +1,9 @@ function write(o, fid, pg, sec, row, col, rep_dir) %function write(o, fid, pg, sec, row, col, rep_dir) -% Write a Graph object +% Write a report_graph object % % INPUTS -% o [graph] graph object +% o [report_graph] report_graph object % fid [integer] file id % pg [integer] this page number % sec [integer] this section number @@ -12,12 +12,12 @@ function write(o, fid, pg, sec, row, col, rep_dir) % rep_dir [string] directory containing report.tex % % OUTPUTS -% o [graph] graph object +% o [report_graph] report_graph object % % SPECIAL REQUIREMENTS % none -% Copyright (C) 2013-2019 Dynare Team +% Copyright (C) 2013-2020 Dynare Team % % This file is part of Dynare. % @@ -36,4 +36,4 @@ function write(o, fid, pg, sec, row, col, rep_dir) graphName = writeGraphFile(o, pg, sec, row, col, rep_dir); fprintf(fid, '\\input{%s}', graphName); -end \ No newline at end of file +end diff --git a/src/@graph/writeGraphFile.m b/src/@report_graph/writeGraphFile.m similarity index 96% rename from src/@graph/writeGraphFile.m rename to src/@report_graph/writeGraphFile.m index c12c6fdbe12fd890615c0ab57790497687b558ab..0724e14d2d5861fbc2ed25629c9f8875058094c8 100644 --- a/src/@graph/writeGraphFile.m +++ b/src/@report_graph/writeGraphFile.m @@ -3,7 +3,7 @@ function graphName = writeGraphFile(o, pg, sec, row, col, rep_dir) % Write the tikz file that contains the graph % % INPUTS -% o [graph] graph object +% o [report_graph] report_graph object % pg [integer] this page number % sec [integer] this section number % row [integer] this row number @@ -16,7 +16,7 @@ function graphName = writeGraphFile(o, pg, sec, row, col, rep_dir) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2013-2019 Dynare Team +% Copyright (C) 2013-2020 Dynare Team % % This file is part of Dynare. % @@ -35,7 +35,7 @@ function graphName = writeGraphFile(o, pg, sec, row, col, rep_dir) ne = length(o.series); if ne < 1 - warning('@graph.writeGraphFile: no series to plot, returning'); + warning('@report_graph.writeGraphFile: no series to plot, returning'); return end @@ -50,7 +50,7 @@ end [fid, msg] = fopen([rep_dir '/' graphName], 'w'); if fid == -1 - error(['@graph.writeGraphFile: ' msg]); + error(['@report_graph.writeGraphFile: ' msg]); end fprintf(fid, '%% Graph Object written %s\n', datestr(now)); @@ -227,7 +227,7 @@ if ~isempty(o.shade) stringsdd = strings(dd); x1 = find(strcmpi(date2string(o.shade(1)), stringsdd)); x2 = find(strcmpi(date2string(o.shade(end)), stringsdd)); - assert(~isempty(x1) && ~isempty(x2), ['@graph.writeGraphFile: either ' ... + assert(~isempty(x1) && ~isempty(x2), ['@report_graph.writeGraphFile: either ' ... date2string(o.shade(1)) ' or ' date2string(o.shade(end)) ' is not in the date ' ... 'range of data selected.']); if x1 == 1 @@ -329,6 +329,6 @@ if o.writeCSV end fprintf(fid, '\\end{axis}\n\\end{tikzpicture}%%'); if fclose(fid) == -1 - error('@graph.writeGraphFile: closing %s\n', o.filename); + error('@report_graph.writeGraphFile: closing %s\n', o.filename); end end diff --git a/src/@section/addGraph.m b/src/@section/addGraph.m index dd794930fb05eb28e1ee22e22b63cc4f2f289289..76998175b1b3da33448e5c447bc6d4462c1f1d9f 100644 --- a/src/@section/addGraph.m +++ b/src/@section/addGraph.m @@ -4,7 +4,7 @@ function o = addGraph(o, varargin) % % INPUTS % o [section] section object -% varargin arguments to graph() +% varargin arguments to report_graph() % % OUTPUTS % updated section object @@ -12,7 +12,7 @@ function o = addGraph(o, varargin) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2013-2019 Dynare Team +% Copyright (C) 2013-2020 Dynare Team % % This file is part of Dynare. % @@ -33,5 +33,5 @@ if ~isempty(o.elements) assert(~isa(o.elements{1}, 'paragraph'), ... '@section.addSeries: A section that contains a paragraph cannot contain a graph or a table'); end -o.elements{end+1} = graph(varargin{:}); +o.elements{end+1} = report_graph(varargin{:}); end diff --git a/src/@section/addSeries.m b/src/@section/addSeries.m index 8418e667257dbacbbac7a45e11ca589a3c225f97..111946022420ebf6ccdb349674dc2c7a3a222a2f 100644 --- a/src/@section/addSeries.m +++ b/src/@section/addSeries.m @@ -12,7 +12,7 @@ function o = addSeries(o, varargin) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2013-2019 Dynare Team +% Copyright (C) 2013-2020 Dynare Team % % This file is part of Dynare. % @@ -33,7 +33,7 @@ assert(~isempty(o.elements), ... '@section.addSeries: Before adding a series, you must add either a graph or a table'); assert(~isa(o.elements{1}, 'paragraph'), ... '@section.addSeries: A section that contains a paragraph cannot contain a graph or a table'); -assert(isa(o.elements{end}, 'graph') || isa(o.elements{end}, 'report_table'), ... - '@report.addSeries: you can only add a series to a report_table or graph object'); +assert(isa(o.elements{end}, 'report_graph') || isa(o.elements{end}, 'report_table'), ... + '@report.addSeries: you can only add a series to a report_table or report_graph object'); o.elements{end}.addSeries(varargin{:}); end