diff --git a/doc/dynare.texi b/doc/dynare.texi index f0adb5d8a4b67af75c0a845d64503afc2b18a224..8ffb78d6dcb5a77d2353614377559cbaec454a08 100644 --- a/doc/dynare.texi +++ b/doc/dynare.texi @@ -10718,7 +10718,7 @@ command. Default: @code{`!'} @end table @end defmethod -@defmethod Report addGraph data, figname, figDirName, graphSize, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, seriesToUse, shade, shadeColor, shadeOpacity, title, xlabel, ylabel, xrange, xTicks, xTickLabels, yrange, showZeroline +@defmethod Report addGraph data, figname, figDirName, graphSize, height, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, seriesToUse, shade, shadeColor, shadeOpacity, title, width, xlabel, ylabel, xrange, xTicks, xTickLabels, yrange, showZeroline Adds a @code{Graph} to a @code{Section}. @optionshead @table @code @@ -10741,6 +10741,9 @@ 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 height, @code{DOUBLE} +The height of the graph, in inches. Default: @code{4.5} + @item showGrid, @code{BOOLEAN} Whether or not to display the minor grid on the graph. Default: @code{true} @@ -10782,6 +10785,9 @@ The opacity of the shaded area, must be in @math{[0,1]}. Default: @code{.2} @item title, @code{STRING} Title for the graph. Default: @code{none} +@item width, @code{DOUBLE} +The width of the graph, in inches. Default: @code{6.0} + @item xlabel, @code{STRING} The x-axis label. Default: @code{none} diff --git a/matlab/reports/@graph/graph.m b/matlab/reports/@graph/graph.m index e2dd102a559361a5a6f6037a8cc90d32fb0d41b9..48c3cbe9515379c8e7bb077e0b0cfca53f956e44 100644 --- a/matlab/reports/@graph/graph.m +++ b/matlab/reports/@graph/graph.m @@ -64,6 +64,9 @@ o.graphSize = []; o.xTicks = []; o.xTickLabels = {}; +o.width = 6; +o.height = 4.5; + if nargin == 1 assert(isa(varargin{1}, 'graph'),['@graph.graph: with one arg you ' ... 'must pass a graph object']); @@ -104,6 +107,9 @@ assert(ischar(o.shadeColor), '@graph.graph: shadeColor must be a string'); assert(isfloat(o.shadeOpacity) && length(o.shadeOpacity)==1 && ... o.shadeOpacity >= 0 && o.shadeOpacity <= 1, ... '@graph.graph: o.shadeOpacity must be a real in [0 1]'); +assert(isfloat(o.width), '@graph.graph: o.width must be a real number'); +assert(isfloat(o.height), '@graph.height: o.width must be a real number'); + valid_legend_locations = ... {'North', 'South', 'East', 'West', ... 'NorthEast', 'SouthEast', 'NorthWest', 'SouthWest', ... diff --git a/matlab/reports/@graph/writeGraphFile.m b/matlab/reports/@graph/writeGraphFile.m index 6d5dfb4eca3be78177cae2716adf6bb0d89e0869..c8a3d9cf03127c703c322c788f4ddb083f0e05a1 100644 --- a/matlab/reports/@graph/writeGraphFile.m +++ b/matlab/reports/@graph/writeGraphFile.m @@ -87,13 +87,13 @@ for i = 1:length(x) end end fprintf(fid, '},\nx tick label style={rotate=45,anchor=east},\n'); -fprintf(fid, ['width=6.0in,\n'... - 'height=4.5in,\n'... +fprintf(fid, ['width=%fin,\n'... + 'height=%fin,\n'... 'scale only axis,\n'... 'xmin=1,\n'... 'xmax=%d,\n'... 'ymin=%d,\n'... - 'ymax=%d,\n'], dd.ndat, ymin, ymax); + 'ymax=%d,\n'], o.width, o.height, dd.ndat, ymin, ymax); if o.showGrid fprintf(fid, 'xmajorgrids=true,\nymajorgrids=true,\n');