diff --git a/doc/dynare.texi b/doc/dynare.texi index 19dabf24a..270fd4d00 100644 --- a/doc/dynare.texi +++ b/doc/dynare.texi @@ -11159,7 +11159,7 @@ command. Default: @code{`!'} @end table @end defmethod -@defmethod Report addGraph data, graphDirName, graphName, graphSize, height, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, seriesToUse, shade, shadeColor, shadeOpacity, title, width, xlabel, ylabel, xAxisTight, xrange, xTicks, xTickLabels, xTickLabelAnchor, xTickLabelRotation, yAxisTight, yrange, showZeroline +@defmethod Report addGraph data, graphDirName, graphName, graphSize, height, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, miscTikzPictureOptions, seriesToUse, shade, shadeColor, shadeOpacity, title, width, xlabel, ylabel, xAxisTight, xrange, xTicks, xTickLabels, xTickLabelAnchor, xTickLabelRotation, yAxisTight, yrange, showZeroline Adds a @code{Graph} to a @code{Section}. @optionshead @table @code @@ -11206,6 +11206,14 @@ Orientation of the legend. Default: @code{`horizontal'} @item legendFontSize, @code{`tiny'} | @code{`scriptsize'} | @code{`footnotesize'} | @code{`small'} | @code{`normalsize'} | @code{`large'} | @code{`Large'} | @code{`LARGE'} | @code{`huge'} | @code{`Huge'} The font size for legend entries. Default: @code{tiny} +@item miscTikzPictureOptions, @code{STRING} +If you are comfortable with PGFPLOTS/Ti@i{k}Z, you can use this option to pass +arguments directly to the PGFPLOTS/Ti@i{k}Z @code{tikzpicture} environment +command. (@i{e.g.,} to scale the graph in the x and y dimensions, you can pass +following to this option: @code{`xscale=2.5, yscale=0.5'}). Specifically to be +used for desired PGFPLOTS/Ti@i{k}Z options that have not been incorporated into +Dynare Reproting. Default: @code{empty} + @anchor{seriesToUse} @item seriesToUse, @code{CELL_ARRAY_STRINGS} The names of the series contained in the @code{dseries} provided to diff --git a/matlab/reports/@graph/graph.m b/matlab/reports/@graph/graph.m index 5be0ee926..5c4f2a0f2 100644 --- a/matlab/reports/@graph/graph.m +++ b/matlab/reports/@graph/graph.m @@ -72,6 +72,8 @@ o.xTickLabelAnchor = 'east'; o.width = 6; o.height = 4.5; +o.miscTikzPictureOptions = ''; + if nargin == 1 assert(isa(varargin{1}, 'graph'),['@graph.graph: with one arg you ' ... 'must pass a graph object']); @@ -105,6 +107,7 @@ 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.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'); diff --git a/matlab/reports/@graph/writeGraphFile.m b/matlab/reports/@graph/writeGraphFile.m index 4fa888ce4..261d3034b 100644 --- a/matlab/reports/@graph/writeGraphFile.m +++ b/matlab/reports/@graph/writeGraphFile.m @@ -49,7 +49,11 @@ if fid == -1 error(['@graph.writeGraphFile: ' msg]); end -fprintf(fid, '\\begin{tikzpicture}[baseline]'); +fprintf(fid, '\\begin{tikzpicture}[baseline'); +if ~isempty(o.miscTikzPictureOptions) + fprintf(fid, ',%s', o.miscTikzPictureOptions); +end +fprintf(fid, ']'); if isempty(o.xrange) dd = getMaxRange(o.series); diff --git a/tests/reporting/runDynareReport.m b/tests/reporting/runDynareReport.m index 9c6f66ed9..f6e51afa3 100644 --- a/tests/reporting/runDynareReport.m +++ b/tests/reporting/runDynareReport.m @@ -236,7 +236,8 @@ rep = rep.addGraph('title', 'Equilibrium World Real Food Price', ... 'xrange', prange, ... 'shade', srange, ... 'showLegend', true, ... - 'xTickLabelRotation', 0); + 'xTickLabelRotation', 0, ... + 'miscTikzPictureOptions', 'xscale=2.5, yscale=0.5'); rep = rep.addSeries('data', db_q{'LRPFOOD_BAR_WORLD'}, ... 'graphLineColor', 'blue', ... 'graphLineWidth', 1.5, ...