File data_analysis/@entanglement_evaluation/plotLogneg.m changed (mode: 100644) (index 5acdbb0..7803fe2) |
... |
... |
function fig = plotLogneg(obj, varargin) |
5 |
5 |
show_lines = true; |
show_lines = true; |
6 |
6 |
linestyle = '.-'; |
linestyle = '.-'; |
7 |
7 |
show_physicality = true; |
show_physicality = true; |
|
8 |
|
show_physicality_legend = true; |
8 |
9 |
only_physical = false; |
only_physical = false; |
9 |
10 |
physicality_marker = 'ok'; |
physicality_marker = 'ok'; |
10 |
11 |
show_legend = true; |
show_legend = true; |
|
... |
... |
function fig = plotLogneg(obj, varargin) |
25 |
26 |
save_fig = varargin{k+1}; |
save_fig = varargin{k+1}; |
26 |
27 |
case {'show_physicality','physicality'} |
case {'show_physicality','physicality'} |
27 |
28 |
show_physicality = varargin{k+1}; |
show_physicality = varargin{k+1}; |
|
29 |
|
case {'show_physicality_legend','physicality_legend'} |
|
30 |
|
show_physicality_legend = varargin{k+1}; |
28 |
31 |
case {'physicality_marker'} |
case {'physicality_marker'} |
29 |
32 |
physicality_marker = varargin{k+1}; |
physicality_marker = varargin{k+1}; |
30 |
33 |
case {'only_physical'} |
case {'only_physical'} |
|
... |
... |
function fig = plotLogneg(obj, varargin) |
130 |
133 |
|
|
131 |
134 |
|
|
132 |
135 |
% add info regarding physicality to plot |
% add info regarding physicality to plot |
133 |
|
if show_physicality |
|
|
136 |
|
if show_physicality && ~only_physical |
134 |
137 |
for k=tracepairs |
for k=tracepairs |
135 |
138 |
physicality = [obj.pulse_CM_is_physical{k}{:}]; |
physicality = [obj.pulse_CM_is_physical{k}{:}]; |
136 |
139 |
lognegs = [obj.logneg_corrected{k}{:}]; |
lognegs = [obj.logneg_corrected{k}{:}]; |
137 |
140 |
lognegs(~physicality)=nan; |
lognegs(~physicality)=nan; |
138 |
141 |
phys_plot = plot(obj.pulse_gammas, lognegs, physicality_marker); |
phys_plot = plot(obj.pulse_gammas, lognegs, physicality_marker); |
139 |
142 |
end |
end |
140 |
|
leg = add_to_legend(leg, phys_plot, 'Physical'); |
|
|
143 |
|
if show_physicality_legend |
|
144 |
|
leg = add_to_legend(leg, phys_plot, 'Physical'); |
|
145 |
|
else |
|
146 |
|
leg = add_to_legend(leg, phys_plot, ''); |
|
147 |
|
end |
141 |
148 |
end |
end |
142 |
149 |
|
|
143 |
150 |
% add info regarding maximum (over evaluated data) |
% add info regarding maximum (over evaluated data) |
|
... |
... |
function fig = plotLogneg(obj, varargin) |
187 |
194 |
|
|
188 |
195 |
% optimize legend position or hide legend if not wanted |
% optimize legend position or hide legend if not wanted |
189 |
196 |
if show_legend |
if show_legend |
190 |
|
reposition_legend(leg, legend_location) |
|
|
197 |
|
leg = compactify_legend(leg); |
|
198 |
|
leg = reposition_legend(leg, legend_location); |
191 |
199 |
else |
else |
192 |
200 |
legend off |
legend off |
193 |
201 |
end |
end |
|
... |
... |
function fig = plotLogneg(obj, varargin) |
209 |
217 |
end |
end |
210 |
218 |
|
|
211 |
219 |
function leg = add_to_legend(leg, plot_handle, leg_str) |
function leg = add_to_legend(leg, plot_handle, leg_str) |
212 |
|
[~,~,plot_handles,leg_strs] = legend(leg); |
|
213 |
|
plot_handles = [plot_handles; plot_handle]; |
|
214 |
|
leg_strs = {leg_strs{:}, leg_str}; |
|
215 |
|
leg = legend(plot_handles, leg_strs{:},... |
|
|
220 |
|
[~,~,plot_handles,leg_strs] = legend(leg); |
|
221 |
|
plot_handles = [plot_handles; plot_handle]; |
|
222 |
|
leg_strs = {leg_strs{:}, leg_str}; |
|
223 |
|
leg = legend(plot_handles, leg_strs{:},... |
216 |
224 |
'Location', 'Best'); |
'Location', 'Best'); |
217 |
225 |
|
|
218 |
|
function reposition_legend(leg, location) |
|
|
226 |
|
function leg = reposition_legend(leg, location) |
219 |
227 |
[~,~,plot_handles,leg_strs] = legend(leg); |
[~,~,plot_handles,leg_strs] = legend(leg); |
220 |
228 |
leg = legend(plot_handles, leg_strs{:},... |
leg = legend(plot_handles, leg_strs{:},... |
221 |
|
'Location', location); |
|
|
229 |
|
'Location', location, 'interpreter', 'latex'); |
|
230 |
|
|
|
231 |
|
function leg = compactify_legend(leg) |
|
232 |
|
[~,~,plot_handles,leg_strs] = legend(leg); |
|
233 |
|
unwanted_inds = strmatch('', leg_strs, 'exact'); |
|
234 |
|
for k=1:length(leg_strs) |
|
235 |
|
if isequal(leg_strs{k}, ['data',num2str(k)]) |
|
236 |
|
unwanted_inds = [unwanted_inds, k]; |
|
237 |
|
end |
|
238 |
|
end |
|
239 |
|
wanted_inds = setdiff(1:length(leg_strs),unwanted_inds); |
|
240 |
|
leg = legend(plot_handles(wanted_inds), leg_strs{wanted_inds},... |
|
241 |
|
'Location', 'Best'); |