Commit ea80bf07 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

reporting: support horizontal lines

parent bf97829e
......@@ -48,6 +48,7 @@ o.graphMarkerSize = 1;
o.graphMiscTikzAddPlotOptions = '';
o.graphHline = {};
o.graphVline = dates();
o.tableShowMarkers = false;
......
......@@ -30,7 +30,7 @@ function o = writeSeriesForGraph(o, fid, xrange)
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
%% Validate options provided by user
if isempty(o.graphVline)
if isempty(o.graphVline) && isempty(o.graphHline)
assert(~isempty(o.data) && isa(o.data, 'dseries'), ['@report_series.writeSeriesForGraph: must ' ...
'provide data as a dseries']);
end
......@@ -68,13 +68,15 @@ assert(~(strcmp(o.graphLineStyle, 'none') && isempty(o.graphMarker)), ['@report_
% Validate graphVline
assert(isdates(o.graphVline), '@report_series.writeSeriesForGraph: graphVline must be a dates');
assert(isempty(o.graphHline) || isnumeric(o.graphHline), ...
'@report_series.writeSeriesForGraph: graphHline must a single numeric value');
% Zero tolerance
assert(isfloat(o.zeroTol), '@report_series.write: zeroTol must be a float');
%% graphVline
if ~isempty(o.graphVline)
if ~isempty(o.graphVline) || ~isempty(o.graphHline)
for i=1:o.graphVline.ndat
fprintf(fid, '%%vline %d\n\\begin{pgfonlayer}{background1}\n\\draw[color=%s,%s,line width=%fpt,line join=round',...
i, o.graphLineColor, o.graphLineStyle, o.graphLineWidth);
......@@ -97,6 +99,27 @@ if ~isempty(o.graphVline)
'cs:%d,\\pgfkeysvalueof{/pgfplots/ymax});\n\\end{pgfonlayer}\n'], ...
x, x);
end
if ~isempty(o.graphHline)
fprintf(fid, '%%hline %d\n\\begin{pgfonlayer}{background1}\n\\draw[color=%s,%s,line width=%fpt,line join=round',...
i, o.graphLineColor, o.graphLineStyle, o.graphLineWidth);
if ~isempty(o.graphMarker)
if isempty(o.graphMarkerEdgeColor)
o.graphMarkerEdgeColor = o.graphLineColor;
end
if isempty(o.graphMarkerFaceColor)
o.graphMarkerFaceColor = o.graphLineColor;
end
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, ['] (axis cs:\\pgfkeysvalueof{/pgfplots/xmin},%f) -- (axis ' ...
'cs:\\pgfkeysvalueof{/pgfplots/xmax},%f);\n\\end{pgfonlayer}\n'], ...
o.graphHline, o.graphHline);
end
return
end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment