reporting: add miscTikzPictureOptions option to addGraph

time-shift
Houtan Bastani 2014-05-19 15:33:42 +02:00
parent c7b2889034
commit eb63ef0267
4 changed files with 19 additions and 3 deletions

View File

@ -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

View File

@ -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');

View File

@ -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);

View File

@ -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, ...