reporting: allow for miscellaneous PGFPlots options to the addPlot command

time-shift
Houtan Bastani 2014-05-19 15:03:37 +02:00
parent 458f8ed95c
commit c7b2889034
4 changed files with 22 additions and 3 deletions

View File

@ -11332,7 +11332,7 @@ Whether or not to show vertical lines separating the columns. Default: @code{fal
@end defmethod
@anchor{addSeries}
@defmethod Report addSeries data, graphLegendName, graphLineColor, graphLineStyle, graphLineWidth, graphMarker, graphMarkerEdgeColor, graphMarkerFaceColor, graphMarkerSize, tableDataRhs, tableRowColor, tableRowIndent, tableShowMarkers, tableAlignRight, tableNegColor, tablePosColor, tableSubSectionHeader, zeroTol
@defmethod Report addSeries data, graphLegendName, graphLineColor, graphLineStyle, graphLineWidth, graphMarker, graphMarkerEdgeColor, graphMarkerFaceColor, graphMarkerSize, graphMiscTikzAddPlotOptions, tableDataRhs, tableRowColor, tableRowIndent, tableShowMarkers, tableAlignRight, tableNegColor, tablePosColor, tableSubSectionHeader, zeroTol
Adds a @code{Series} to a @code{Graph} or a @code{Table}.
@optionshead
@table @code
@ -11365,6 +11365,15 @@ The face color of the graph marker. Default: @code{graphLineColor}
@item graphMarkerSize, @code{DOUBLE}
The size of the graph marker. Default: @code{1}
@item graphMiscTikzAddPlotOptions, @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{addPlots} command. (@i{e.g.,}
Instead of passing the marker options above, you can pass a string such as the
following to this option: @code{`mark=halfcircle*,mark
options={rotate=90,scale=3}'}). Specifically to be used for desired
PGFPLOTS/Ti@i{k}Z options that have not been incorporated into Dynare
Reproting. Default: @code{empty}
@item tableDataRhs, @code{dseries}
A series to be added to the right of the current series. Usefull for
displaying aggregate data for a series. @i{e.g} if the series is

View File

@ -46,6 +46,8 @@ o.graphMarkerEdgeColor = '';
o.graphMarkerFaceColor = '';
o.graphMarkerSize = 1;
o.graphMiscTikzAddPlotOptions = '';
o.tableShowMarkers = false;
o.tableNegColor = 'red';
o.tablePosColor = 'blue';

View File

@ -33,6 +33,9 @@ function o = writeSeriesForGraph(o, fid, xrange)
assert(~isempty(o.data) && isa(o.data, 'dseries'), ['@report_series.writeSeriesForGraph: must ' ...
'provide data as a dseries']);
assert(ischar(o.graphMiscTikzAddPlotOptions), ['@report_series.writeSeriesForGraph: ' ...
'graphMiscTikzAddPlotOptions file must be a string']);
% Line
valid_graphLineColor = {'red', 'green', 'blue', 'cyan ', 'magenta', 'yellow', ...
'black', 'gray', 'darkgray', 'lightgray', 'brown', ...
@ -96,6 +99,9 @@ if ~isempty(o.graphMarker)
fprintf(fid, ',mark=%s,mark size=%f,every mark/.append style={draw=%s,fill=%s}',...
o.graphMarker,o.graphMarkerSize,o.graphMarkerEdgeColor,o.graphMarkerFaceColor);
end
if ~isempty(o.graphMiscTikzAddPlotOptions)
fprintf(fid, ',%s', o.graphMiscTikzAddPlotOptions)
end
fprintf(fid,']\ntable[row sep=crcr]{\nx y\\\\\n');
for i=1:ds.dates.ndat
fprintf(fid, '%d %f\\\\\n', i, thedata(i));

View File

@ -240,12 +240,14 @@ rep = rep.addGraph('title', 'Equilibrium World Real Food Price', ...
rep = rep.addSeries('data', db_q{'LRPFOOD_BAR_WORLD'}, ...
'graphLineColor', 'blue', ...
'graphLineWidth', 1.5, ...
'graphLegendName', 'baseline');
'graphLegendName', 'baseline', ...
'graphMiscTikzAddPlotOptions', 'mark=halfcircle*,color=red');
rep = rep.addSeries('data', dc_q{'LRPFOOD_BAR_WORLD'}, ...
'graphLineColor', 'blue', ...
'graphLineStyle', 'dashed', ...
'graphLineWidth', 1.5, ...
'graphLegendName', 'control');
'graphLegendName', 'control', ...
'graphMiscTikzAddPlotOptions', 'mark=halfcircle*,mark options={rotate=90,scale=3}');
%% Write & Compile Report
rep.write();