reporting: add option 'ALL' to xTickLabels

remove-priordens
Houtan Bastani 2014-02-20 16:35:05 +01:00
parent eacea6d66d
commit 7dfe38198c
2 changed files with 12 additions and 5 deletions

View File

@ -161,10 +161,13 @@ assert(isempty(o.graphSize) || ((isfloat(o.graphSize) && length(o.graphSize) ==
'entries, [width height]']);
assert(isempty(o.xTicks) || isfloat(o.xTicks),...
'@graph.graph: xTicks must be a numerical array');
assert(iscellstr(o.xTickLabels), ...
'@graph.graph: xTickLabels must be a cell array of strings');
assert(iscellstr(o.xTickLabels) || (ischar(o.xTickLabels) && strcmpi(o.xTickLabels, 'ALL')), ...
['@graph.graph: xTickLabels must be a cell array of strings or ' ...
'equivalent to the string ''ALL''']);
if ~isempty(o.xTickLabels)
assert(~isempty(o.xTicks), '@graph.graph: if you set xTickLabels, you must set xTicks');
assert((ischar(o.xTickLabels) && strcmpi(o.xTickLabels, 'ALL')) || ...
~isempty(o.xTicks), ['@graph.graph: if you set xTickLabels and ' ...
'it''s not equal to ''ALL'', you must set xTicks']);
end
if ~isempty(o.xTicks)
assert(~isempty(o.xTickLabels), '@graph.graph: if you set xTicks, you must set xTickLabels');

View File

@ -56,11 +56,11 @@ if isempty(o.xrange)
else
dd = o.xrange;
end
stringsdd = strings(dd);
fprintf(fid, '\\begin{axis}[%%\n');
% set tick labels
if isempty(o.xTickLabels)
stringsdd = strings(dd);
if ~isempty(o.shade)
x1 = find(strcmpi(date2string(o.shade(1)), stringsdd));
x = [1 x1 dd.ndat];
@ -70,10 +70,13 @@ if isempty(o.xTickLabels)
xTickLabels = [stringsdd(1) stringsdd(end)];
end
fprintf(fid, 'xminorticks=true,\nyminorticks=true,\n');
else
elseif iscell(o.xTickLabels)
fprintf(fid,'minor xtick,\n');
x = o.xTicks;
xTickLabels = o.xTickLabels;
else
x = [1:dd.ndat];
xTickLabels = strings(dd);
end
fprintf(fid, 'xticklabels={');
xlen = length(x);
@ -167,6 +170,7 @@ for i=1:ne
end
if ~isempty(o.shade)
stringsdd = strings(dd);
x1 = find(strcmpi(date2string(o.shade(1)), stringsdd));
x2 = find(strcmpi(date2string(o.shade(end)), stringsdd));
assert(~isempty(x1) && ~isempty(x2), ['@graph.writeGraphFile: either ' ...