-
Notifications
You must be signed in to change notification settings - Fork 5
/
showfields.m
25 lines (24 loc) · 1.1 KB
/
showfields.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
% SHOWFIELDS - show multiple 2D gridded data as set of subplot images
%
% SHOWFIELDS(g, h, u, c, name) plots figure with subplot image j from the
% 2D grid data u(:,:,j) with x-grid g and y-grid h. name gives the figure
% title name, and c the size of the symmetric caxis scale. If u is complex,
% shows Re and Im part separately. Uses tsubplot to maximize size
%
% See also SHOWFIELD.
function showfields(g, h, u, c, name)
n = size(u, 3); % # fields or subplots
re = isreal(u); % true if only Re needed
nh = floor(sqrt(1.8*n)); nv = ceil(n/nh); % how many across and down, subplot
if re, figure('name', name); else, figure('name', sprintf('%s, Re', name)); end
for j=1:n, tsubplot(nv, nh, j); imagesc(g, h, real(squeeze(u(:,:,j))));
caxis(c*[-1 1]); set(gca, 'ydir', 'normal'); axis equal tight; % off;
colormap(jet(256));
end
if ~re
figure('name', sprintf('%s, Im', name));
for j=1:n, tsubplot(nv, nh, j); imagesc(g, h, imag(squeeze(u(:,:,j))));
caxis(c*[-1 1]); set(gca, 'ydir', 'normal'); axis equal tight; % off;
colormap(jet(256));
end
end