File data_analysis/@meta_ev/plot_cuts.m changed (mode: 100644) (index 1a869a2..bf8e0d0) |
1 |
|
function plot_cuts(meta, plot_type, tracepairs_ind, par_ind, par_vals, varargin) |
|
2 |
|
assertEqual(meta.gridtype,'matrix',... |
|
3 |
|
'only implemented for gridtype "matrix"') |
|
|
1 |
|
function plot_cuts(meta, plot_type, tracepairs_ind, varargin) |
|
2 |
|
switch meta.gridtype |
|
3 |
|
case 'vector' |
|
4 |
|
par_ind = 2; |
|
5 |
|
par_vals = 'all'; |
|
6 |
|
args = {par_ind, par_vals, varargin{:}}; |
|
7 |
|
case 'matrix' |
|
8 |
|
args = {varargin{:}}; |
|
9 |
|
otherwise |
|
10 |
|
error('"plot_cuts" is only implemented for gridtypes "matrix" or "vector".') |
|
11 |
|
end |
|
12 |
|
plot_cuts_matrix(meta, plot_type, tracepairs_ind, args{:}); |
|
13 |
|
|
|
14 |
|
|
|
15 |
|
function plot_cuts_matrix(meta, plot_type, tracepairs_ind, par_ind, par_vals, varargin) |
|
16 |
|
% assertEqual(meta.gridtype,'matrix',... |
|
17 |
|
% 'only implemented for gridtype "matrix"') |
4 |
18 |
if isequal(par_vals, 'all') |
if isequal(par_vals, 'all') |
5 |
19 |
meta_filtered = meta.copy; |
meta_filtered = meta.copy; |
6 |
20 |
else |
else |
|
... |
... |
function plot_cuts(meta, plot_type, tracepairs_ind, par_ind, par_vals, varargin) |
33 |
47 |
legend_title_maxlength = inf; |
legend_title_maxlength = inf; |
34 |
48 |
linewidth = 1.5; |
linewidth = 1.5; |
35 |
49 |
subplotnum = 111; |
subplotnum = 111; |
|
50 |
|
show_zero = false; |
36 |
51 |
for k=1:2:length(varargin) |
for k=1:2:length(varargin) |
37 |
52 |
switch lower(varargin{k}) |
switch lower(varargin{k}) |
38 |
53 |
case {'x_scale','xscale'} |
case {'x_scale','xscale'} |
|
... |
... |
function plot_cuts(meta, plot_type, tracepairs_ind, par_ind, par_vals, varargin) |
47 |
62 |
y_scale = varargin{k+1}; |
y_scale = varargin{k+1}; |
48 |
63 |
case {'y_lims','ylims','y_lim','ylim'} |
case {'y_lims','ylims','y_lim','ylim'} |
49 |
64 |
y_lims = varargin{k+1}; |
y_lims = varargin{k+1}; |
|
65 |
|
case {'show_zero', 'showzero'} |
|
66 |
|
show_zero = varargin{k+1}; |
50 |
67 |
case {'figure','fig'} |
case {'figure','fig'} |
51 |
68 |
fig = varargin{k+1}; |
fig = varargin{k+1}; |
52 |
69 |
case {'subplot'} |
case {'subplot'} |
53 |
70 |
subplotnum = varargin{k+1}; |
subplotnum = varargin{k+1}; |
54 |
71 |
case {'label','fig_label','figlabel'} |
case {'label','fig_label','figlabel'} |
55 |
72 |
meta.fig_label = varargin{k+1}; |
meta.fig_label = varargin{k+1}; |
56 |
|
case {'colororder', 'color_order', 'colors'} |
|
|
73 |
|
case {'colororder', 'color_order', 'colors', 'color'} |
57 |
74 |
colororder = varargin{k+1}; |
colororder = varargin{k+1}; |
58 |
75 |
case {'legend_postfix','legendpostfix'} |
case {'legend_postfix','legendpostfix'} |
59 |
76 |
legend_postfix = varargin{k+1}; |
legend_postfix = varargin{k+1}; |
|
... |
... |
function plot_cuts(meta, plot_type, tracepairs_ind, par_ind, par_vals, varargin) |
102 |
119 |
else |
else |
103 |
120 |
legend_parser = @(num) [legend_number_parser(num), ' (', legend_postfix,')']; |
legend_parser = @(num) [legend_number_parser(num), ' (', legend_postfix,')']; |
104 |
121 |
end |
end |
105 |
|
cut_labels = arrayfun(legend_parser, unique(meta_filtered.params{par_ind}),... |
|
106 |
|
'UniformOutput', false); |
|
|
122 |
|
switch meta.gridtype |
|
123 |
|
case 'vector' |
|
124 |
|
cut_labels = sentence_case(meta.meta_label); |
|
125 |
|
case 'matrix' |
|
126 |
|
cut_labels = arrayfun(legend_parser, unique(meta_filtered.params{par_ind}),... |
|
127 |
|
'UniformOutput', false); |
|
128 |
|
end |
107 |
129 |
plot(x_data, y_data, linestyle, 'LineWidth', linewidth, 'DisplayName', cut_labels); |
plot(x_data, y_data, linestyle, 'LineWidth', linewidth, 'DisplayName', cut_labels); |
108 |
130 |
labels(meta_filtered.param_names{x_ind},display_name); |
labels(meta_filtered.param_names{x_ind},display_name); |
109 |
131 |
set(gca, 'xscale', x_scale, 'yscale', y_scale) |
set(gca, 'xscale', x_scale, 'yscale', y_scale) |
110 |
132 |
meta_ev.xylims(x_lims, y_lims); |
meta_ev.xylims(x_lims, y_lims); |
111 |
133 |
leg = legend('Location', legend_location); |
leg = legend('Location', legend_location); |
112 |
134 |
legtitle = get(leg,'title'); |
legtitle = get(leg,'title'); |
113 |
|
title_str = sentence_case(meta_filtered.param_names{par_ind}); |
|
|
135 |
|
switch meta.gridtype |
|
136 |
|
case 'matrix' |
|
137 |
|
title_str = sentence_case(meta_filtered.param_names{par_ind}); |
|
138 |
|
otherwise |
|
139 |
|
title_str = ''; |
|
140 |
|
end |
114 |
141 |
if ~(legend_title_maxlength==inf) |
if ~(legend_title_maxlength==inf) |
115 |
142 |
title_str = linewrap(title_str, legend_title_maxlength); |
title_str = linewrap(title_str, legend_title_maxlength); |
116 |
143 |
end |
end |
|
... |
... |
function plot_cuts(meta, plot_type, tracepairs_ind, par_ind, par_vals, varargin) |
120 |
147 |
'LineWidth', 1, 'Interpreter', 'latex','FontSize',11); |
'LineWidth', 1, 'Interpreter', 'latex','FontSize',11); |
121 |
148 |
|
|
122 |
149 |
meta.my_postprocess_plot(meta.(fig_handle)); |
meta.my_postprocess_plot(meta.(fig_handle)); |
123 |
|
if isequal(display_name, 'Max. log. negativity') |
|
|
150 |
|
if show_zero |
124 |
151 |
hline=refline(0,0); set(hline, 'Color', 'k', 'DisplayName',' '); |
hline=refline(0,0); set(hline, 'Color', 'k', 'DisplayName',' '); |
125 |
152 |
end |
end |