reporting: add subtitles for graphs, closes #580

remove-priordens
Houtan Bastani 2014-02-17 12:11:41 +01:00
parent a4b45bae37
commit a71b8808df
2 changed files with 20 additions and 3 deletions

View File

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

View File

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