reporting: re-impliment yrange option

time-shift
Houtan Bastani 2014-02-11 18:25:50 +01:00
parent 623081cd32
commit db50e96193
2 changed files with 14 additions and 14 deletions

View File

@ -55,14 +55,19 @@ else
dd = o.xrange;
end
ymax = zeros(1, ne);
ymin = zeros(1, ne);
for i=1:ne
ymax(i) = o.series{i}.ymax(dd);
ymin(i) = o.series{i}.ymin(dd);
if isempty(o.yrange)
ymax = zeros(1, ne);
ymin = zeros(1, ne);
for i=1:ne
ymax(i) = o.series{i}.ymax(dd);
ymin(i) = o.series{i}.ymin(dd);
end
ymax = ceil(max(ymax));
ymin = floor(min(ymin));
else
ymin = o.yrange(1);
ymax = o.yrange(2);
end
ymax = ceil(max(ymax));
ymin = floor(min(ymin));
fprintf(fid, '\\begin{axis}[%%\n');
% set tick labels
@ -113,12 +118,6 @@ if ~isempty(o.ylabel)
end
fprintf(fid, ']\n');
%if ~isempty(o.yrange)
% fprintf(fid, '\\clip (1,%f) rectangle (%d, %f);\n', ...
% o.yrange(1), dd.ndat, o.yrange(2));
%end
if o.showZeroline
fprintf(fid, '%%zeroline\n\\addplot[black,line width=.5,forget plot] coordinates {(1,0)(%d,0)};\n',dd.ndat);
end

View File

@ -225,7 +225,8 @@ rep = rep.addGraph('title', 'World Real Food Price', ...
'showLegend', true, ...
'xTicks', [1,5,10,15,find(srange(1)==prange),length(prange)], ...
'xTickLabels',{startpoint{:},'2008Q1','2009Q2','2010Q3',shaded{:}, endpoint{:}},...
'xTickLabelRotation', 0);
'xTickLabelRotation', 0,...
'yrange',[400 500]);
rep = rep.addSeries('data', db_q{'LRPFOOD_WORLD'}, ...
'graphLineColor', 'blue', ...
'graphLineWidth', 1.5);