v4: added first incomplete version of dynare_graph* function

git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1023 ac1d8469-bf42-47a9-8791-bf33cf982152
time-shift
michel 2006-11-04 16:15:09 +00:00
parent b45ad0d64c
commit e1a801375c
3 changed files with 117 additions and 0 deletions

40
matlab/dynare_graph.m Normal file
View File

@ -0,0 +1,40 @@
function dynare_graph(y,tit,x)
% function dynare_graph_init(y,tit)
% graphs
% INPUT
% figure_name: name of the figures
% colors: line colors
% OUTPUT
% none
% ALGORITHM
% none
% SPECIAL REQUIREMENT
% none
%
% part of DYNARE, copyright S. Adjemian, M. Juillard (2006)
% Gnu Public License.
global dyn_graph
if nargin < 3
x = (1:size(y,1))';
end
nplot = dyn_graph.plot_nbr + 1;
if nplot > dyn_graph.max_nplot
figure('Name',dyn_graph.figure_name);
nplot = 1;
end
dyn_graph.plot_nbr = nplot;
subplot(dyn_graph.nr,dyn_graph.nc,nplot);
line_types = dyn_graph.line_types;
line_type = line_types{1};
for i=1:size(y,2);
if length(line_types) > 1
line_type = line_types{i};
end
plot(x,y(:,i),line_type);
hold on
end
title(tit);
hold off

View File

@ -0,0 +1,14 @@
function dynare_graph_close()
% function dynare_graph_close()
% close a figure
% INPUT
% none
% OUTPUT
% none
% ALGORITHM
% none
% SPECIAL REQUIREMENT
% none
%
% part of DYNARE, copyright S. Adjemian, M. Juillard (2006)
% Gnu Public License.

View File

@ -0,0 +1,63 @@
function dynare_graph_init(figure_name,nplot,line_types,line_width)
% function dynare_graph_init(figure_name,colors) initializes set of
% graphs
% INPUT
% figure_name: name of the figures
% colors: line colors
% OUTPUT
% none
% ALGORITHM
% none
% SPECIAL REQUIREMENT
% none
%
% part of DYNARE, copyright S. Adjemian, M. Juillard (2006)
% Gnu Public License.
global dyn_graph options_
dyn_graph.fh = figure('Name',figure_name);
dyn_graph.figure_name = figure_name;
if nargin > 2
dyn_graph.line_types = line_types;
else
dyn_graph.line_types = options_.graphics.line_types;
end
if nargin > 3
dyn_graph.line_width = line_width;
else
dyn_graph.line_width = options_.graphics.line_width;
end
dyn_graph.plot_nbr = 0;
switch(nplot)
case 1
dyn_graph.nc = 1;
dyn_graph.nr = 1;
case 2
dyn_graph.nc = 1;
dyn_graph.nr = 2;
case 3
dyn_graph.nc = 1;
dyn_graph.nr = 3;
case 4
dyn_graph.nc = 2;
dyn_graph.nr = 2;
case 5
dyn_graph.nc = 3;
dyn_graph.nr = 2;
case 6
dyn_graph.nc = 3;
dyn_graph.nr = 2;
case 7
dyn_graph.nc = 4;
dyn_graph.nr = 2;
case 8
dyn_graph.nc = 4;
dyn_graph.nr = 2;
otherwise
dyn_graph.nc = min(nplot,options_.graphics.ncols);
dyn_graph.nr = min(ceil(nplot/dyn_graph.nc),options_.graphics.nrows);
end
dyn_graph.max_nplot = dyn_graph.nc*dyn_graph.nr;