reporting: add subtitles for graphs, closes #580
parent
be7b11d7c8
commit
28716ed52a
|
@ -10769,8 +10769,14 @@ The color to use in the shaded portion of the graph. Default:
|
|||
@item shadeOpacity, @code{DOUBLE}
|
||||
The opacity of the shaded area, must be in @math{[0,100]}. Default: @code{20}
|
||||
|
||||
@item title, @code{STRING}
|
||||
Title for the graph. Default: @code{none}
|
||||
@anchor{graph.title}
|
||||
@item title, @code{STRING} | @code{CELL_ARRAY_STRINGS}
|
||||
Same as @ref{title}, just for graphs.
|
||||
|
||||
@item titleFormat, @code{STRING}
|
||||
The format to use for @ref{graph.title,,the graph title}. Unlike
|
||||
@ref{titleFormat}, due to a constraint of TikZ, this format applies to
|
||||
the title and subtitles. Default: @code{TikZ default}
|
||||
|
||||
@item width, @code{DOUBLE}
|
||||
The width of the graph, in inches. Default: @code{6.0}
|
||||
|
|
|
@ -36,6 +36,7 @@ o = struct;
|
|||
o.series = {};
|
||||
|
||||
o.title = '';
|
||||
o.titleFormat = '';
|
||||
o.ylabel = '';
|
||||
o.xlabel = '';
|
||||
|
||||
|
@ -97,7 +98,11 @@ elseif nargin > 1
|
|||
end
|
||||
|
||||
% Check options provided by user
|
||||
assert(ischar(o.title), '@graph.graph: title must be a string');
|
||||
if ischar(o.title)
|
||||
o.title = {o.title};
|
||||
end
|
||||
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.figname), '@graph.graph: figname must be a string');
|
||||
|
|
|
@ -88,8 +88,20 @@ fprintf(fid, ['},\n',...
|
|||
'axis lines=box,\n'...
|
||||
'unbounded coords=jump,\n'], o.width, o.height);
|
||||
|
||||
if ~isempty(o.title)
|
||||
fprintf(fid, 'title=%s,\n', o.title);
|
||||
if ~isempty(o.title{1})
|
||||
fprintf(fid, 'title style={align=center');
|
||||
if ~isempty(o.titleFormat)
|
||||
fprintf(fid, ',font=%s', o.titleFormat);
|
||||
end
|
||||
fprintf(fid, '},\ntitle=');
|
||||
nt = length(o.title);
|
||||
for i=1:nt
|
||||
fprintf(fid, '%s', o.title{i});
|
||||
if i ~= nt
|
||||
fprintf(fid, '\\\\');
|
||||
end
|
||||
end
|
||||
fprintf(fid, ',\n');
|
||||
end
|
||||
|
||||
if o.xAxisTight
|
||||
|
|
|
@ -95,6 +95,7 @@ rep = rep.addSeries('data', dc_q{['PCH_GROWTH_' countryAbbr]}, ...
|
|||
'graphLineWidth', 1.5);
|
||||
|
||||
rep = rep.addGraph('title', 'Core Inflation (y/y)', ...
|
||||
'titleFormat', '\Huge', ...
|
||||
'xrange', prange, ...
|
||||
'shade', srange, ...
|
||||
'showZeroline', true, ...
|
||||
|
|
|
@ -150,7 +150,7 @@ rep = rep.addPage('title', 'Jan1 vs Jan2', ...
|
|||
'titleFormat', '\large\bfseries');
|
||||
rep = rep.addSection();
|
||||
|
||||
rep = rep.addGraph('title', 'World Real Oil Price Index', ...
|
||||
rep = rep.addGraph('title', {'World Real Oil Price Index','SUBTITLE'}, ...
|
||||
'xrange', prange, ...
|
||||
'shade', srange, ...
|
||||
'xTicks', [1,5,10,15,find(srange(1)==prange),length(prange)], ...
|
||||
|
|
Loading…
Reference in New Issue