| MESH toolbox 0.1 Matlab/Octave mesh utils

- Main Page
- Related Pages
- Modules
- Files

- File List
- File Members

All Files Functions Groups Pages
PlotVal.m
Go to the documentation of this file.
1 function h=PlotVal(varargin)
2 % function h=PlotVal(varargin)
3 % Plot given values on mesh
4 %
5 % parameters:
6 % Th : mesh structure
7 % Val : `2\times\nq` double array
8 % CameraPosition : given value is [x y z]
9 % colormap : set colormap value to \'Jet\', \'HSV\', \'Gray\', \'colorcube\',\'Cool\',\'Spring\',\'Summer\',...
10 % shading : set shading interp at true or false
11 % colorbar : set colorbar visible at true or false
12 %
13 % Example:
14 % @verbatim
15 % Plotval(Th,u,'colormap','Cool');@endverbatim
16 % \image html images/PlotVal.png "figure : Plotval(Th,u,\'colormap\',\'Cool\');"
17 p = inputParser;
18 p.addRequired('Th', @isstruct);
19 p.addRequired('Val', @isnumeric);
20 %
21 p.addParamValue('CameraPosition', [], @isnumeric );
22 p.addParamValue('colormap', 'Jet' , @isstr );
23 p.addParamValue('shading', true , @islogical );
24 p.addParamValue('colorbar', true , @islogical );
25
26 p.parse(varargin{:});
27 Th=p.Results.Th;
28
29 colormap(p.Results.colormap)
30 h=trisurf(Th.me',Th.q(1,:),Th.q(2,:),p.Results.Val);
31 xmin=min(Th.q(1,:));xmax=max(Th.q(1,:));
32 ymin=min(Th.q(2,:));ymax=max(Th.q(2,:));
33
34 axis equal
35 axis off
36 if p.Results.shading
37 shading interp
38 end
39 if isempty(p.Results.CameraPosition)
40 set(gca,'CameraPosition',[(xmin+xmax)/2 (ymin+ymax)/2 10])
41 else
42 set(gca,'CameraPosition',p.Results.CameraPosition)
43 end
44 if p.Results.colorbar
45 colorbar
46 end