Commit 424050f3 authored by Johannes Pfeifer's avatar Johannes Pfeifer Committed by Stéphane Adjemian
Browse files

Make sure IRFs only have full periods as xticks

parent 73afe7d0
......@@ -119,6 +119,7 @@ for i=fpar:npar,
box on
axis tight
xlim([1 options_.irf]);
remove_fractional_xticks;
hold off
else
h1 = area(1:options_.irf,HPDIRF(:,2,j,i),'FaceColor',[.9 .9 .9],'BaseValue',min([min(HPDIRF(:,1,j,i)),min(HPDIRFdsgevar(:,1,j,i))])); %grey below HPDIsup and minimum of HPDIinf and HPDIRFdsgevar
......@@ -132,6 +133,7 @@ for i=fpar:npar,
box on
axis tight
xlim([1 options_.irf]);
remove_fractional_xticks;
hold off
end
name = deblank(varlist(j,:));
......
......@@ -262,6 +262,7 @@ if options_.irf
plot([1 options_.irf],[0 0],'-r','linewidth',0.5);
hold off
xlim([1 options_.irf]);
remove_fractional_xticks;
title(deblank(mylist(j,:)),'Interpreter','none');
end
dyn_saveas(hh,[M_.fname '_IRF_' deblank(tit(i,:))],options_);
......@@ -271,7 +272,7 @@ if options_.irf
fprintf(fidTeX,['\\psfrag{%s}[1][][0.5][0]{$%s$}\n'],deblank(mylist(j,:)),deblank(mylistTeX(j,:)));
end
fprintf(fidTeX,'\\centering \n');
fprintf(fidTeX,'\\includegraphics[scale=0.5]{%s_IRF_%s}\n',M_.fname,deblank(tit(i,:)));
fprintf(fidTeX,'\\includegraphics[width=0.8\\textwidth]{%s_IRF_%s}\n',M_.fname,deblank(tit(i,:)));
fprintf(fidTeX,'\\caption{Impulse response functions (orthogonalized shock to $%s$).}',titTeX(i,:));
fprintf(fidTeX,'\\label{Fig:IRF:%s}\n',deblank(tit(i,:)));
fprintf(fidTeX,'\\end{figure}\n');
......@@ -293,6 +294,7 @@ if options_.irf
plot([1 options_.irf],[0 0],'-r','linewidth',0.5);
hold off
xlim([1 options_.irf]);
remove_fractional_xticks
title(deblank(mylist((fig-1)*nstar+plt,:)),'Interpreter','none');
end
dyn_saveas(hh,[ M_.fname '_IRF_' deblank(tit(i,:)) int2str(fig)],options_);
......@@ -302,7 +304,7 @@ if options_.irf
fprintf(fidTeX,['\\psfrag{%s}[1][][0.5][0]{$%s$}\n'],deblank(mylist((fig-1)*nstar+j,:)),deblank(mylistTeX((fig-1)*nstar+j,:)));
end
fprintf(fidTeX,'\\centering \n');
fprintf(fidTeX,'\\includegraphics[scale=0.5]{%s_IRF_%s%s}\n',M_.fname,deblank(tit(i,:)),int2str(fig));
fprintf(fidTeX,'\\includegraphics[width=0.8\\textwidth]{%s_IRF_%s%s}\n',M_.fname,deblank(tit(i,:)),int2str(fig));
if options_.relative_irf
fprintf(fidTeX,['\\caption{Relative impulse response' ...
' functions (orthogonalized shock to $%s$).}'],deblank(titTeX(i,:)));
......@@ -325,6 +327,7 @@ if options_.irf
plot([1 options_.irf],[0 0],'-r','linewidth',0.5);
hold off
xlim([1 options_.irf]);
remove_fractional_xticks
title(deblank(mylist((nbplt-1)*nstar+plt,:)),'Interpreter','none');
end
dyn_saveas(hh,[ M_.fname '_IRF_' deblank(tit(i,:)) int2str(nbplt) ],options_);
......@@ -334,7 +337,7 @@ if options_.irf
fprintf(fidTeX,['\\psfrag{%s}[1][][0.5][0]{$%s$}\n'],deblank(mylist((nbplt-1)*nstar+j,:)),deblank(mylistTeX((nbplt-1)*nstar+j,:)));
end
fprintf(fidTeX,'\\centering \n');
fprintf(fidTeX,'\\includegraphics[scale=0.5]{%s_IRF_%s%s}\n',M_.fname,deblank(tit(i,:)),int2str(nbplt));
fprintf(fidTeX,'\\includegraphics[width=0.8\\textwidth]{%s_IRF_%s%s}\n',M_.fname,deblank(tit(i,:)),int2str(nbplt));
if options_.relative_irf
fprintf(fidTeX,['\\caption{Relative impulse response functions' ...
' (orthogonalized shock to $%s$).}'],deblank(titTeX(i,:)));
......
function remove_fractional_xticks
% function remove_fractional_xticks
% removes non-integer xtick-labels
% Copyright (C) 2001-2016 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
xticks=get(gca,'xtick');
fractional_periods=find(rem(xticks,1)~=0);
if ~isempty(fractional_periods)
xticks(fractional_periods)=[];
xticklabels=get(gca,'xticklabel');
xticklabels(fractional_periods)=[];
set(gca,'xtick',xticks);
set(gca,'xticklabel',xticklabels);
end
\ No newline at end of file
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