-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot2D_xepr.m
65 lines (53 loc) · 1.3 KB
/
plot2D_xepr.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
function phandle = plot2D_xepr(varargin)
%PLOT2D_XEPR Plots Xepr data as 2D contour plot.
%
% In addition to PLOT2D, PLOT2D_XEPR will create axis labels and an
% appropriate legend automatically from pars.
%
% SYNTAX:
% PLOT2D_XEPR(dset)
% PLOT2D_XEPR(ax, ...)
%
% INPUT:
% ax - Axis handle for plot. If not given, the data is plotted in
% the current axis, as returned by gca.
% dset - Xepr data set
%
% OUTPUT:
% phandle - plot handle
%
import esr_analyses.*
import esr_analyses.utils.*
%% Input Analyses
if ishghandle(varargin{1}, 'axes')
ax = varargin{1};
dset = varargin{2};
else
ax = gca;
dset = varargin{1};
end
x = dset{:,1};
pars = dset.Properties.UserData;
assert_2d_exp(dset)
N = width(dset) - 1;
x_label = sprintf('%s [%s]', pars.XNAM, pars.XUNI);
y_label = sprintf('%s [%s]', pars.YNAM, pars.YUNI);
color_label = sprintf('%s [%s]', pars.IRNAM{1}, pars.IRUNI{1});
for k=1:N
y = dset{:,k+1};
%% Plot
subplot(1,N,k)
plot2D(x, pars.y_axis, y);
xlabel(x_label, 'Interpreter', 'none');
ylabel(y_label, 'Interpreter', 'none');
cbar = colorbar;
cbar.Title.String = color_label;
title(dset.Properties.VariableNames{k+1})
axis square
end
sgtitle(pars.TITL, 'Interpreter', 'none');
%% Argout
if nargout > 0
phandle = ax;
end
end