diff --git a/doc/dynare.texi b/doc/dynare.texi index 3ce0fb5f8..2bb303b7e 100644 --- a/doc/dynare.texi +++ b/doc/dynare.texi @@ -8240,7 +8240,7 @@ command. Default: @code{`!'} @end table @end defmethod -@defmethod Report addGraph data, figname, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, seriesToUse, shade, shadeColor, shadeOpacity, title, xlabel, ylabel, xrange, yrange, showZeroline +@defmethod Report addGraph data, figname, graphSize, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, seriesToUse, shade, shadeColor, shadeOpacity, title, xlabel, ylabel, xrange, yrange, showZeroline Adds a @code{Graph} to a @code{Section}. @optionshead @table @code @@ -8253,6 +8253,12 @@ The @code{dynSeries} that provides the data for the graph. Default: The name to use when saving this figure. Default: @code{[tempname `.tex']} +@item graphSize, @code{NUMERICAL_VECTOR} +The width and height to be passed to the third and fourth elements of +the array passed to the @code{`Position'} option of Matlab's +@code{figure} command, passed as a vector of size @math{2}. Default: +Matlab sets width and height + @item showGrid, @code{BOOLEAN} Whether or not to display the minor grid on the graph. Default: @code{true} diff --git a/matlab/reports/@graph/createGraph.m b/matlab/reports/@graph/createGraph.m index 69e73c4f1..9788521ca 100755 --- a/matlab/reports/@graph/createGraph.m +++ b/matlab/reports/@graph/createGraph.m @@ -38,7 +38,11 @@ if ~o.seriesElements.numSeriesElements() return; end -h = figure('visible','off'); +if isempty(o.graphSize) + h = figure('visible','off'); +else + h = figure('visible','off','position',[1, 1, o.graphSize(1), o.graphSize(2)]); +end hold on; box on; if o.showGrid diff --git a/matlab/reports/@graph/graph.m b/matlab/reports/@graph/graph.m index a92003b12..62565770f 100644 --- a/matlab/reports/@graph/graph.m +++ b/matlab/reports/@graph/graph.m @@ -59,6 +59,8 @@ o.legendFontSize = 8; o.showZeroline = false; +o.graphSize = []; + if nargin == 1 assert(isa(varargin{1}, 'graph'),['@graph.graph: with one arg you ' ... 'must pass a graph object']); @@ -127,6 +129,10 @@ assert(isempty(o.data) || isa(o.data, 'dynSeries'), ['@graph.graph: data must ' assert(isempty(o.seriesToUse) || iscellstr(o.seriesToUse), ['@graph.graph: ' ... 'series to use must be a cell array of string(s)']); +assert(isempty(o.graphSize) || ((isfloat(o.graphSize) && length(o.graphSize) == 2)),... + ['@graph.graph: graphSize is specified as an array with two float ' ... + 'entries, [width height]']); + % using o.seriesToUse, create series objects and put them in o.seriesElements if ~isempty(o.data) if isempty(o.seriesToUse)