reporting: add graph option: zeroLineColor

time-shift
Houtan Bastani 2014-06-20 15:40:20 +02:00
parent 499967f9a1
commit 6733c83ff5
4 changed files with 14 additions and 5 deletions

View File

@ -11239,7 +11239,7 @@ command. Default: @code{`!'}
@end defmethod
@anchor{addGraph}
@defmethod Report addGraph data, graphDirName, graphName, graphSize, height, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, miscTikzAxisOptions, miscTikzPictureOptions, seriesToUse, shade, shadeColor, shadeOpacity, title, width, xlabel, ylabel, xAxisTight, xrange, xTicks, xTickLabels, xTickLabelAnchor, xTickLabelRotation, yAxisTight, yTickLabelFixed, yTickLabelPrecision, yTickLabelZeroFill, yrange, showZeroline
@defmethod Report addGraph data, graphDirName, graphName, graphSize, height, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, miscTikzAxisOptions, miscTikzPictureOptions, seriesToUse, shade, shadeColor, shadeOpacity, title, width, xlabel, ylabel, xAxisTight, xrange, xTicks, xTickLabels, xTickLabelAnchor, xTickLabelRotation, yAxisTight, yTickLabelFixed, yTickLabelPrecision, yTickLabelZeroFill, yrange, showZeroline, zeroLineColor
Adds a @code{Graph} to a @code{Section}.
@optionshead
@table @code
@ -11390,9 +11390,14 @@ The precision with which to report the yTickLabel. Default: @code{1}
@item yTickLabelZeroFill, @code{BOOLEAN}
Whether or not to fill missing precision spots with zeros. Default: @code{true}
@anchor{showZeroLine}
@item showZeroline, @code{BOOLEAN}
Display a solid black line at @math{y = 0}. Default: @code{false}
@item zeroLineColor, @code{`red'} | @code{`green'} | @code{`blue'} | @code{`cyan'} | @code{`magenta'} | @code{`yellow'} | @code{`black'} | @code{`gray'} | @code{`darkgray'} | @code{`lightgray'} | @code{`brown'} | @code{`lime'} | @code{`olive'} | @code{`orange'} | @code{`pink'} | @code{`purple'} | @code{`teal'} | @code{`violet'} | @code{`white'}
The color to use for the zero line. Only used if @ref{showZeroLine} is
true. Default: @code{`black'}
@end table
@end defmethod

View File

@ -62,6 +62,7 @@ o.legendOrientation = 'horizontal';
o.legendFontSize = 'tiny';
o.showZeroline = false;
o.zeroLineColor = 'black';
o.graphSize = [];
o.xTicks = [];
@ -132,12 +133,13 @@ assert(ischar(o.xTickLabelAnchor), '@graph.graph: xTickLabelAnchor must be a str
assert(isint(o.yTickLabelPrecision), '@graph.graph: o.yTickLabelPrecision must be an integer');
assert(islogical(o.yTickLabelFixed), '@graph.graph: yTickLabelFixed must be either true or false');
assert(islogical(o.yTickLabelZeroFill), '@graph.graph: yTickLabelZeroFill must be either true or false');
valid_shadeColor = {'red', 'green', 'blue', 'cyan ', 'magenta', 'yellow', ...
'black', 'gray', 'darkgray', 'lightgray', 'brown', ...
'lime', 'olive', 'orange', 'pink', 'purple', 'teal', 'violet', 'white'};
assert(any(strcmp(o.shadeColor, valid_shadeColor)), ['@graph.graph: shadeColor must be one of ' ...
strjoin(valid_shadeColor)]);
assert(any(strcmp(o.zeroLineColor, valid_shadeColor)), ...
['@graph.graph: zeroLineColor must be one of ' strjoin(valid_shadeColor)]);
valid_legend_locations = ...
{'south west','south east','north west','north east','outer north east'};

View File

@ -212,7 +212,8 @@ if ~isempty(o.shade)
end
if o.showZeroline
fprintf(fid, '%%zeroline\n\\addplot[black,line width=.5,forget plot] coordinates {(1,0)(%d,0)};\n',dd.ndat);
fprintf(fid, '%%zeroline\n\\addplot[%s,line width=.5,forget plot] coordinates {(1,0)(%d,0)};\n', ...
o.zeroLineColor, dd.ndat);
end
for i=1:ne

View File

@ -65,8 +65,9 @@ r = report();
r = r.addSection('cols', 2);
@# for var in endovars
r = r.addGraph('data', shock@{shock}.@{var}, 'title', '@{var}', ...
'showGrid', false, 'yTickLabelPrecision', 2, 'yTickLabelZeroFill', false);
r = r.addSeries('graphHline', 0, 'graphLineColor', 'red');
'showGrid', false, 'yTickLabelPrecision', 2, ...
'yTickLabelZeroFill', false, ...
'showZeroLine', true, 'zeroLineColor', 'red');
@# endfor
r = r.addVspace('number', 2);
r = r.addSection('cols', 1);