0001 function dynare_graph_init(figure_name,nplot,line_types,line_width)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 global dyn_graph options_
0033
0034 dyn_graph.fh = figure('Name',figure_name);
0035 dyn_graph.figure_name = figure_name;
0036 if nargin > 2
0037 dyn_graph.line_types = line_types;
0038 else
0039 dyn_graph.line_types = options_.graphics.line_types;
0040 end
0041 if nargin > 3
0042 dyn_graph.line_width = line_width;
0043 else
0044 dyn_graph.line_width = options_.graphics.line_width;
0045 end
0046
0047 dyn_graph.plot_nbr = 0;
0048
0049 switch(nplot)
0050 case 1
0051 dyn_graph.nc = 1;
0052 dyn_graph.nr = 1;
0053 case 2
0054 dyn_graph.nc = 1;
0055 dyn_graph.nr = 2;
0056 case 3
0057 dyn_graph.nc = 1;
0058 dyn_graph.nr = 3;
0059 case 4
0060 dyn_graph.nc = 2;
0061 dyn_graph.nr = 2;
0062 case 5
0063 dyn_graph.nc = 3;
0064 dyn_graph.nr = 2;
0065 case 6
0066 dyn_graph.nc = 3;
0067 dyn_graph.nr = 2;
0068 case 7
0069 dyn_graph.nc = 4;
0070 dyn_graph.nr = 2;
0071 case 8
0072 dyn_graph.nc = 4;
0073 dyn_graph.nr = 2;
0074 otherwise
0075 dyn_graph.nc = min(nplot,options_.graphics.ncols);
0076 dyn_graph.nr = min(ceil(nplot/dyn_graph.nc),options_.graphics.nrows);
0077 end
0078 dyn_graph.max_nplot = dyn_graph.nc*dyn_graph.nr;