Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dynare
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stéphane Adjemian
dynare
Commits
4199f577
Commit
4199f577
authored
Nov 27, 2023
by
Johannes Pfeifer
Browse files
Options
Downloads
Patches
Plain Diff
GSA scatter plots: clean up files and enable TeX-output
parent
94c13436
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
matlab/gsa/scatter_analysis.m
+9
-4
9 additions, 4 deletions
matlab/gsa/scatter_analysis.m
matlab/gsa/scatter_plots.m
+33
-35
33 additions, 35 deletions
matlab/gsa/scatter_plots.m
with
42 additions
and
39 deletions
matlab/gsa/scatter_analysis.m
+
9
−
4
View file @
4199f577
function
indmcf
=
scatter_analysis
(
lpmat
,
xdata
,
options_scatter
,
options_
)
function
scatter_analysis
(
lpmat
,
xdata
,
options_scatter
,
options_
)
% scatter_analysis(lpmat, xdata, options_scatter, options_)
% Plot scatter plot analysis
%
%
% Written by Marco Ratto
% Written by Marco Ratto
% Joint Research Centre, The European Commission,
% Joint Research Centre, The European Commission,
...
@@ -6,7 +8,7 @@ function indmcf = scatter_analysis(lpmat, xdata, options_scatter, options_)
...
@@ -6,7 +8,7 @@ function indmcf = scatter_analysis(lpmat, xdata, options_scatter, options_)
%
%
% Copyright © 2017 European Commission
% Copyright © 2017 European Commission
% Copyright © 2017 Dynare Team
% Copyright © 2017
-2023
Dynare Team
%
%
% This file is part of Dynare.
% This file is part of Dynare.
%
%
...
@@ -34,7 +36,6 @@ if options_.TeX
...
@@ -34,7 +36,6 @@ if options_.TeX
end
end
amcf_name
=
options_scatter
.
amcf_name
;
amcf_name
=
options_scatter
.
amcf_name
;
amcf_title
=
options_scatter
.
amcf_title
;
amcf_title
=
options_scatter
.
amcf_title
;
title
=
options_scatter
.
title
;
fname_
=
options_scatter
.
fname_
;
fname_
=
options_scatter
.
fname_
;
xparam1
=
[];
xparam1
=
[];
if
isfield
(
options_scatter
,
'xparam1'
)
if
isfield
(
options_scatter
,
'xparam1'
)
...
@@ -48,5 +49,9 @@ if ~options_.nograph
...
@@ -48,5 +49,9 @@ if ~options_.nograph
if
~
isempty
(
xparam1
)
if
~
isempty
(
xparam1
)
xx
=
xparam1
;
xx
=
xparam1
;
end
end
if
options_
.
TeX
scatter_plots
(
lpmat
,
xdata
,
param_names_tex
,
'.'
,
[
fname_
,
'_'
,
amcf_name
],
OutputDirectoryName
,
amcf_title
,
xx
,
options_
)
else
scatter_plots
(
lpmat
,
xdata
,
param_names
,
'.'
,
[
fname_
,
'_'
,
amcf_name
],
OutputDirectoryName
,
amcf_title
,
xx
,
options_
)
scatter_plots
(
lpmat
,
xdata
,
param_names
,
'.'
,
[
fname_
,
'_'
,
amcf_name
],
OutputDirectoryName
,
amcf_title
,
xx
,
options_
)
end
end
end
This diff is collapsed.
Click to expand it.
matlab/gsa/scatter_plots.m
+
33
−
35
View file @
4199f577
function
scatter_plots
(
X
,
xp
,
vnames
,
plotsymbol
,
fnam
,
dirname
,
figtitle
,
xparam1
,
options_
)
function
scatter_plots
(
X
,
xp
,
vnames
,
plotsymbol
,
fnam
,
dirname
,
figtitle
,
xparam1
,
options_
)
% scatter_plots(X,xp,vnames,plotsymbol, fnam, dirname, figtitle, xparam1, options_)
% Pairwise scatter plots of the columns of x and y after Monte Carlo filtering
% Inputs:
% - X [double] nxk matrix with columns containing behavioural sample
% - xp [double] mxk matrix with columns containing non-behavioural sample
% - vnames [char] vector of variable names (default = numeric labels 1,2,3 etc.)
% - plotsymbol [char] plt symbol (default = '.' for npts > 100, 'o' for npts < 100
% - fnam [char] figure name
% - dirname [char] directory name
% - figtitle [char] figure title
% - xparam1 [double] parameter vector
% - options_ [struct] option structure
%
%
% Written by Marco Ratto
% Written by Marco Ratto
% Joint Research Centre, The European Commission,
% Joint Research Centre, The European Commission,
% marco.ratto@ec.europa.eu
% marco.ratto@ec.europa.eu
%
% Copyright © 2017 European Commission
% Copyright © 2017 European Commission
% Copyright © 2017-2023 Dynare Team
% Copyright © 2017-2023 Dynare Team
...
@@ -23,23 +35,7 @@ function scatter_plots(X,xp,vnames,plotsymbol, fnam, dirname, figtitle, xparam1,
...
@@ -23,23 +35,7 @@ function scatter_plots(X,xp,vnames,plotsymbol, fnam, dirname, figtitle, xparam1,
% You should have received a copy of the GNU General Public License
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
% PURPOSE: Pairwise scatter plots of the columns of x and y after
% Monte Carlo filtering
%---------------------------------------------------
% USAGE: scatter_mcf(x,y,vnames,pltsym,diagon)
% or scatter_mcf(x,y) which relies on defaults
% where:
% x = an nxk matrix with columns containing behavioural sample
% y = an mxk matrix with columns containing non-behavioural sample
% vnames = a vector of variable names
% (default = numeric labels 1,2,3 etc.)
% pltsym = a plt symbol
% (default = '.' for npts > 100, 'o' for npts < 100
[
n
,
p
]
=
size
(
X
);
[
n
,
p
]
=
size
(
X
);
% X = X - ones(n,1)*min(Z);
% X = X ./ (ones(n,1)*max(Z));
nflag
=
0
;
nflag
=
0
;
if
nargin
>=
3
if
nargin
>=
3
...
@@ -47,8 +43,10 @@ if nargin >=3
...
@@ -47,8 +43,10 @@ if nargin >=3
end
end
if
nargin
<
4
||
isempty
(
plotsymbol
)
if
nargin
<
4
||
isempty
(
plotsymbol
)
if
n
*
p
<
100
,
plotsymbol
=
'o'
;
if
n
*
p
<
100
else
plotsymbol
=
'.'
;
plotsymbol
=
'o'
;
else
plotsymbol
=
'.'
;
end
end
end
end
...
@@ -71,7 +69,7 @@ end
...
@@ -71,7 +69,7 @@ end
figtitle_tex
=
strrep
(
figtitle
,
'_'
,
'\_'
);
figtitle_tex
=
strrep
(
figtitle
,
'_'
,
'\_'
);
fig_nam_
=
[
fnam
]
;
fig_nam_
=
fnam
;
hh_fig
=
dyn_figure
(
options_
.
nodisplay
,
'name'
,
figtitle
);
hh_fig
=
dyn_figure
(
options_
.
nodisplay
,
'name'
,
figtitle
);
set
(
hh_fig
,
'userdata'
,{
X
,
xp
})
set
(
hh_fig
,
'userdata'
,{
X
,
xp
})
...
@@ -90,7 +88,6 @@ for i = 1:p
...
@@ -90,7 +88,6 @@ for i = 1:p
if
i
==
j
if
i
==
j
h1
=
cumplot
(
X
(:,
j
));
h1
=
cumplot
(
X
(:,
j
));
set
(
h
,
'Tag'
,
'cumplot'
)
set
(
h
,
'Tag'
,
'cumplot'
)
% set(h1,'color',[0 0 1], 'linestyle','--','LineWidth',1.5)
set
(
h1
,
'color'
,[
0
0
1
],
'LineWidth'
,
1.5
)
set
(
h1
,
'color'
,[
0
0
1
],
'LineWidth'
,
1.5
)
if
~
isempty
(
xparam1
)
if
~
isempty
(
xparam1
)
hold
on
,
plot
(
xparam1
([
j
j
]),[
0
1
],
'k--'
)
hold
on
,
plot
(
xparam1
([
j
j
]),[
0
1
],
'k--'
)
...
@@ -101,12 +98,8 @@ for i = 1:p
...
@@ -101,12 +98,8 @@ for i = 1:p
grid
off
grid
off
end
end
set
(
gca
,
'YTickLabel'
,[],
'YTick'
,[]);
set
(
gca
,
'YTickLabel'
,[],
'YTick'
,[]);
else
if
j
>
i
plot
(
X
(:,
i
),
X
(:,
j
),[
plotsymbol
,
'b'
])
else
else
plot
(
X
(:,
i
),
X
(:,
j
),[
plotsymbol
,
'b'
])
plot
(
X
(:,
i
),
X
(:,
j
),[
plotsymbol
,
'b'
])
end
set
(
h
,
'Tag'
,
'scatter'
)
set
(
h
,
'Tag'
,
'scatter'
)
%%
%%
...
@@ -134,7 +127,6 @@ for i = 1:p
...
@@ -134,7 +127,6 @@ for i = 1:p
hold
on
,
plot
(
xparam1
(
i
),
xparam1
(
j
),
's'
,
'MarkerFaceColor'
,[
0
0.75
0
],
'MarkerEdgeColor'
,[
0
0.75
0
])
hold
on
,
plot
(
xparam1
(
i
),
xparam1
(
j
),
's'
,
'MarkerFaceColor'
,[
0
0.75
0
],
'MarkerEdgeColor'
,[
0
0.75
0
])
end
end
hold
off
;
hold
off
;
% axis([-0.1 1.1 -0.1 1.1])
if
i
<
p
if
i
<
p
set
(
gca
,
'YTickLabel'
,[],
'YTick'
,[]);
set
(
gca
,
'YTickLabel'
,[],
'YTick'
,[]);
else
else
...
@@ -149,16 +141,26 @@ for i = 1:p
...
@@ -149,16 +141,26 @@ for i = 1:p
end
end
if
i
==
1
if
i
==
1
if
nflag
==
1
if
nflag
==
1
if
options_
.
TeX
ylabel
(
vnames
(
j
,:),
'Rotation'
,
45
,
'interpreter'
,
'latex'
,
...
'HorizontalAlignment'
,
'right'
,
'VerticalAlignment'
,
'middle'
);
else
ylabel
(
vnames
(
j
,:),
'Rotation'
,
45
,
'interpreter'
,
'none'
,
...
ylabel
(
vnames
(
j
,:),
'Rotation'
,
45
,
'interpreter'
,
'none'
,
...
'HorizontalAlignment'
,
'right'
,
'VerticalAlignment'
,
'middle'
);
'HorizontalAlignment'
,
'right'
,
'VerticalAlignment'
,
'middle'
);
end
else
else
ylabel
([
num2str
(
j
),
' '
],
'Rotation'
,
90
)
ylabel
([
num2str
(
j
),
' '
],
'Rotation'
,
90
)
end
end
end
end
if
j
==
1
if
j
==
1
if
nflag
==
1
if
nflag
==
1
if
options_
.
TeX
title
(
vnames
(
i
,:),
'interpreter'
,
'latex'
,
'Rotation'
,
45
,
...
'HorizontalAlignment'
,
'left'
,
'VerticalAlignment'
,
'bottom'
)
else
title
(
vnames
(
i
,:),
'interpreter'
,
'none'
,
'Rotation'
,
45
,
...
title
(
vnames
(
i
,:),
'interpreter'
,
'none'
,
'Rotation'
,
45
,
...
'HorizontalAlignment'
,
'left'
,
'VerticalAlignment'
,
'bottom'
)
'HorizontalAlignment'
,
'left'
,
'VerticalAlignment'
,
'bottom'
)
end
else
else
title
(
num2str
(
i
))
title
(
num2str
(
i
))
end
end
...
@@ -166,10 +168,6 @@ for i = 1:p
...
@@ -166,10 +168,6 @@ for i = 1:p
drawnow
drawnow
end
end
end
end
% if ~isoctave
% annotation('textbox', [0.1,0,0.35,0.05],'String', beha_name,'Color','Blue','horizontalalignment','center','interpreter','none');
% annotation('textbox', [0.55,0,0.35,0.05],'String', non_beha_name,'Color','Red','horizontalalignment','center','interpreter','none');
% end
if
~
nograph
if
~
nograph
dyn_saveas
(
hh_fig
,[
dirname
,
filesep
,
fig_nam_
],
options_
.
nodisplay
,
options_
.
graph_format
);
dyn_saveas
(
hh_fig
,[
dirname
,
filesep
,
fig_nam_
],
options_
.
nodisplay
,
options_
.
graph_format
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment