0001 function MakeAllFigures(NumberOfPlots,Caption,FigureProperties,Info)
0002
0003 global M_ options_
0004
0005 FigHandle = figure('Name',FigureProperties.Name);
0006
0007 NAMES = cell(NumberOfPlots,1);
0008 if options_.TeX
0009 TeXNAMES = cell(NumberOfPlots,1);
0010 end
0011
0012 if NumberOfPlots == 9
0013 nr = 3;
0014 nc = 3;
0015 elseif NumberOfPlots == 8
0016 nr = 3;
0017 nc = 3;
0018 elseif NumberOfPlots == 7
0019 nr = 3;
0020 nc = 3;
0021 elseif NumberOfPlots == 6
0022 nr = 2;
0023 nc = 3;
0024 elseif NumberOfPlots == 5
0025 nr = 3;
0026 nc = 2;
0027 elseif NumberOfPlots == 4
0028 nr = 2;
0029 nc = 2;
0030 elseif NumberOfPlots == 3
0031 nr = 2;
0032 nc = 2;
0033 elseif NumberOfPlots == 2
0034 nr = 1;
0035 nc = 2;
0036 elseif NumberOfPlots == 1
0037 nr = 1;
0038 nc = 1;
0039 end
0040
0041 for plt = 1:NumberOfPlots
0042 eval(['NumberOfCurves = Info.Box' int2str(plt) '.Number;'])
0043 NumberOfObservations = zeros(2,1);
0044 x = cell(NumberOfCurves,1);
0045 y = cell(NumberOfCurves,1);
0046 PltType = cell(NumberofCurves,1);
0047 top = NaN(NumberOfCurves,1);
0048 bottom = NaN(NumberOfCurves,1);
0049 binf = NaN(NumberOfCurves,1);
0050 bsup = NaN(NumberOfCurves,1);
0051 for curve = 1:NumberOfCurves
0052 eval(['x{' curve '} = Info.Box' int2str(plt) '.Curve' int2str(curve) '.xdata;'])
0053 eval(['y{' curve '} = Info.Box' int2str(plt) '.Curve' int2str(curve) '.ydata;'])
0054 eval(['name = Info.Box' int2str(plt) '.Curve' int2str(curve) '.variablename;'])
0055 eval(['PltType{' curve '} = Info.Box' int2str(plt) '.Curve' int2str(curve) '.type']);
0056 if length(x{curve})-length(y{curve})
0057 disp('MakeFigure :: The number of observations in x doesn''t match with ')
0058 disp(['the number of observation in y for ' name ])
0059 return
0060 end
0061 if Info.PlotProperties.CutTop
0062 top(curve) = max(y{curve});
0063 else Info.PlotProperties.CutBottom
0064 bottom(curve) = min(y{curve});
0065 end
0066 binf(curve) = min(x{curve});
0067 bsup(curve) = max(x{curve});
0068 end
0069 ymax = max(top);
0070 ymin = min(bottom);
0071 xmin = min(binf);
0072 xmax = max(bsup);
0073 if isnan(ymin(plt))
0074 ymin = 0;
0075 end
0076 eval(['NAMES{' int2str(plt) '} = Info.Box' int2str(plt) '.name;'])
0077 if options_.TeX
0078 eval(['TeXNAMES{' int2str(plt) '} = Info.Box' int2str(plt) '.texname;'])
0079 end
0080 subplot(nr,nc,plt)
0081 hold on
0082 for curve = 1:NumberOfCurves
0083 hh = plot(x{curve},y{curve});
0084 if strcmpi(PltType{curve},'PriorDensity')
0085 set(hh,'Color',[0.7 0.7 0.7],'LineStyle','-','LineWidth',2)
0086
0087
0088 elseif strcmpi(PltType{curve},'DensityEstimate')
0089 set(hh,'Color','k','LineStyle','-','LineWidth',2)
0090
0091
0092 elseif strcmpi(PltType{curve},'ModeEstimate')
0093 set(hh,'Color','g','LineStyle','--','LineWidth',2)
0094
0095
0096 elseif strcmpi(PltType{curve},'SmoothVariable')
0097 set(hh,'Color','k','LineStyle','-','LineWidth',2)
0098
0099
0100 elseif strcmpi(PltType{curve},'Deciles')
0101 set(hh,'Color','g','LineStyle','-','LineWidth',1)
0102
0103
0104 elseif strcmpi(PltType{curve},'Forecasts')
0105 set(hh,'Color','','LineStyle','-','LineWidth',2)
0106
0107
0108 elseif strcmpi(PltType{curve},'ForecastsHPD')
0109 set(hh,'Color','k','LineStyle','-','LineWidth',1)
0110
0111
0112 elseif strcmpi(PltType{curve},'ForecastsDeciles')
0113 set(hh,'Color','g','LineStyle','-','LineWidth',1)
0114
0115
0116 elseif strcmpi(PltType{curve},'DiagnosticWithin')
0117 set(hh,'Color','b','LineStyle','-','LineWidth',2)
0118
0119
0120 elseif strcmpi(PltType{curve},'DiagnosticPooled')
0121 set(hh,'Color','r','LineStyle','-','LineWidth',2)
0122
0123
0124 end
0125 end
0126 axis([xmin xmax ymin ymax])
0127 title(NAMES{plt})
0128 drawnow
0129 hold off
0130 end
0131
0132 if Info.SaveFormat.Eps
0133 if isempty(Info.SaveFormat.Name)
0134 eval(['print -depsc2 ' M_.fname Info.SaveFormat.GenericName int2str(Info.SaveFormat.Number)]);
0135 else
0136 eval(['print -depsc2 ' M_.fname Info.SaveFormat.GenericName Info.SaveFormat.Name]);
0137 end
0138 end
0139 if Info.SaveFormat.Pdf
0140 if isempty(Info.SaveFormat.Name)
0141 eval(['print -dpdf ' M_.fname Info.SaveFormat.GenericName int2str(Info.SaveFormat.Number)]);
0142 else
0143 eval(['print -dpdf ' M_.fname Info.SaveFormat.GenericName Info.SaveFormat.Name]);
0144 end
0145 end
0146 if Info.SaveFormat.Fig
0147 if isempty(Info.SaveFormat.Name)
0148 saveas(FigHandle,[M_.fname Info.SaveFormat.GenericName int2str(Info.SaveFormat.Number) '.fig']);
0149 else
0150 saveas(FigHandle,[M_.fname Info.SaveFormat.GenericName Info.SaveFormat.Name '.fig']);
0151 end
0152 end