Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion matlab/NekSnaps.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
index=1;
pfun='x';
verbose=true;
plot_type='surface';

% plot options
colormap='jet';
Expand Down Expand Up @@ -199,7 +200,7 @@ function show(obj,index,pfun)
ptitle = [ptitle, ', ', ff{1}];

ax = gca;
patch_plot(xJ, yJ, fJ, [], 'ColorMap', obj.colormap, 'Title', ptitle, 'EdgeColor', obj.ecolor);
patch_plot(xJ, yJ, fJ, [], 'ColorMap', obj.colormap, 'Title', ptitle, 'EdgeColor', obj.ecolor,'PlotType',obj.plot_type);
obj.index=index;
obj.pfun=pfun;
end
Expand Down
23 changes: 20 additions & 3 deletions matlab/patch_plot.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function patch_plot(x, y, z, filename, varargin)
ecolor = 'k';

cmap = 'jet';

plot_type='surface';
cpos=[];
ctgt=[];
cvec=[];
Expand All @@ -27,6 +27,8 @@ function patch_plot(x, y, z, filename, varargin)
ctgt = varargin{k+1};
elseif strcmp(varargin{k}, 'CameraVector')
cvec = varargin{k+1};
elseif strcmp(varargin{k}, 'PlotType')
plot_type= varargin{k+1};
end
end

Expand All @@ -50,13 +52,28 @@ function patch_plot(x, y, z, filename, varargin)

a1=0;
a2=0;
interval=5;
start=interval;
stop=100 - interval;
level_weights = [start:interval:stop]/100;
levels = (1-level_weights)*zmin + level_weights*zmax;
for i = 1:size(z, 3)
surface(x(:,:,i), y(:,:,i), z(:,:,i),'FaceColor','interp','EdgeColor','none'); hold on
if strcmp(plot_type, 'surface')
surface(x(:,:,i), y(:,:,i), z(:,:,i),'FaceColor','interp','EdgeColor','none'); hold on
elseif strcmp(plot_type, 'contour')
contour(x(:,:,i), y(:,:,i), z(:,:,i),levels); hold on
else
error('Unrecognized plot type');
end;
end

colormap(cmap);
cb=colorbar;
cb.TickLabelInterpreter = 'latex';
try
cb.TickLabelInterpreter = 'latex';
catch
warning('colorbar is not an object in Octave');
end;

if ~strcmp(ecolor, '')
zconst = zeros(size(x,1),1)+zmax+(zmax-zmin)*0.01;
Expand Down