annotate toolboxes/MIRtoolbox1.3.2/somtoolbox/som_cplane.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 function h=som_cplane(varargin)
Daniel@0 2
Daniel@0 3 %SOM_CPLANE Visualize one 2D component plane, U-matrix or color plane.
Daniel@0 4 %
Daniel@0 5 % h=som_cplane(lattice, msize, color, [s], [pos])
Daniel@0 6 % h=som_cplane(topol, color, [s], [pos])
Daniel@0 7 %
Daniel@0 8 % som_cplane('hexa', [10 5], 'none');
Daniel@0 9 % som_cplane('rect', [10 5], 'r');
Daniel@0 10 % som_cplane(sM.topol, sM.codebook(:,1));
Daniel@0 11 % U = som_umat(sM); som_cplane('hexaU',sM.topol.msize,U(:));
Daniel@0 12 %
Daniel@0 13 % Input and output arguments ([]'s are optional):
Daniel@0 14 % lattice (string) 'hexa', 'rect' (component planes)
Daniel@0 15 % 'hexaU', 'rectU' (corresponding U-matrices)
Daniel@0 16 % (matrix) defines the patch (see function VIS_PATCH).
Daniel@0 17 % msize (vector) 1x2 vector defines grid size (M=prod(msize))
Daniel@0 18 % (matrix) Mx2 matrix gives explicit coordinates for each node
Daniel@0 19 % topol (struct) map or topology struct
Daniel@0 20 % color color for the nodes
Daniel@0 21 % (matrix) Mx1 matrix gives indexed colors for the units
Daniel@0 22 % Mx3 matrix of RGB triples gives explicit
Daniel@0 23 % color for each unit
Daniel@0 24 % (Note: in case of U-matrix, the number of color
Daniel@0 25 % values is 4*prod(msize)-2*sum(msize)+1, not prod(msize))
Daniel@0 26 % (string) ColorSpec gives the same color for each node
Daniel@0 27 % 'none' draws black edges only.
Daniel@0 28 % [s] (matrix) size Mx1, gives individual size scaling for each node
Daniel@0 29 % (scalar) gives the same size for each node, default=1.
Daniel@0 30 % Additional features: see 'type som_cplane'
Daniel@0 31 % This argument is ignored if the lattice is 'rectU' or 'hexaU'.
Daniel@0 32 % [pos] (vector) a 1x2 vector that determines position of origin,
Daniel@0 33 % default is [1 1].
Daniel@0 34 %
Daniel@0 35 % h (scalar) the object handle for the PATCH object
Daniel@0 36 %
Daniel@0 37 % Axis are set to the 'ij' mode with equal spacing and turned off if
Daniel@0 38 % 'pos' is not given. If 'lattice' is 'rect', 'hexa', 'rectU' or
Daniel@0 39 % 'hexaU' the node (a,b) has coordinates (a,b) (+pos), except on the
Daniel@0 40 % even numbered rows on the 'hexa' and 'hexaU' grids where the
Daniel@0 41 % coordinates are (a,b+0.5) (+pos).
Daniel@0 42 %
Daniel@0 43 % For more help, try 'type som_cplane' or check out online documentation.
Daniel@0 44 % See also SOM_PIEPLANE, SOM_PLOTPLANE, SOM_BARPLANE, VIS_PATCH,
Daniel@0 45 % SOM_VIS_COORDS
Daniel@0 46
Daniel@0 47 %%%%%%%%%%%%% DETAILED DESCRIPTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Daniel@0 48 %
Daniel@0 49 % som_cplane
Daniel@0 50 %
Daniel@0 51 % PURPOSE
Daniel@0 52 %
Daniel@0 53 % Visualizes a 2D component plane or u-matrix
Daniel@0 54 %
Daniel@0 55 % SYNTAX
Daniel@0 56 %
Daniel@0 57 % h = som_cplane(topol, color)
Daniel@0 58 % h = som_cplane(lattice, msize, color)
Daniel@0 59 % h = som_cplane(lattice, msize, color)
Daniel@0 60 % h = som_cplane(..., size)
Daniel@0 61 % h = som_cplane(..., size, pos)
Daniel@0 62 %
Daniel@0 63 % DESCRIPTION
Daniel@0 64 %
Daniel@0 65 % Creates some basic visualizations of the SOM grid: the component plane and
Daniel@0 66 % the unified distance matrix. The routine draws the SOM grid as a patch
Daniel@0 67 % object according to the specifications given in the input arguments and
Daniel@0 68 % returns its object handle.
Daniel@0 69 %
Daniel@0 70 % Each unit of the map is presented by a polygon whose color, size, shape
Daniel@0 71 % and location can be specified in various ways. The usual procedure
Daniel@0 72 % is to choose the lattice and map size used in the map training. Then
Daniel@0 73 % the function creates the standard sheet shaped topological
Daniel@0 74 % representation of the map grid with hexagonal or rectangular units.
Daniel@0 75 % When the values from a map codebook component (or from SOM_UMAT)
Daniel@0 76 % are given to the function it produces an indexed coloring for the
Daniel@0 77 % units (as in SURF command). Another possibility is to give a fixed
Daniel@0 78 % RGB color for each unit explicitly.
Daniel@0 79 %
Daniel@0 80 % Special effects (variable unit size, location or shape) can be produced
Daniel@0 81 % giving different types of input variables.
Daniel@0 82 %
Daniel@0 83 % KNOWN BUGS
Daniel@0 84 %
Daniel@0 85 % Using 1x3 or 3x1 grids causes problem, as the MATLAB will treat the color
Daniel@0 86 % information vector 1x3 or 3x1 as a single RGB triple. So, using indexed
Daniel@0 87 % colors is not possible for this particular map size.
Daniel@0 88 %
Daniel@0 89 % It is not possible to specify explicit coordinates for map
Daniel@0 90 % consistig of just one unit as then the msize is interpreted as
Daniel@0 91 % map size.
Daniel@0 92 %
Daniel@0 93 % REQUIRED INPUT ARGUMENTS
Daniel@0 94 %
Daniel@0 95 % Note: M is the number of map units
Daniel@0 96 %
Daniel@0 97 % lattice The basic shape of the map units
Daniel@0 98 %
Daniel@0 99 % (string) 'hexa' or 'rect' creates standard component plane;
Daniel@0 100 % 'hexaU' or 'rectU' creates standard u-matrix.
Daniel@0 101 % (matrix) Lx2 matrix defines the cornes of an arbitary polygon to be used
Daniel@0 102 % as the unit marker. (L is the number of patch vertex: L=6 for
Daniel@0 103 % 'hexa' and L=4 for 'rect')
Daniel@0 104 %
Daniel@0 105 % msize The size of the map grid
Daniel@0 106 %
Daniel@0 107 % (vector) [n1 n2] vector defines the map size (height n1 units, width
Daniel@0 108 % n2 units, total M=n1 x n2 units). The units will be placed to their
Daniel@0 109 % topological locations to form a uniform hexagonal or rectangular grid.
Daniel@0 110 % (matrix) Mx2 matrix defines arbitrary coordinates for the M units
Daniel@0 111 % In this case the argument 'lattice' defines the unit form only.
Daniel@0 112 %
Daniel@0 113 % topol Topology of the map grid
Daniel@0 114 %
Daniel@0 115 % (struct) map or topology struct from which the topology is taken
Daniel@0 116 %
Daniel@0 117 % color Unit colors
Daniel@0 118 %
Daniel@0 119 % (string) (ColorSpec) gives the same color for each unit, 'none'
Daniel@0 120 % draws black unit edges only.
Daniel@0 121 % (vector) Mx1 column vector gives indexed color for each unit using the
Daniel@0 122 % current colormap (see help colormap).
Daniel@0 123 % (matrix) Mx3 matrix of RGB triples as rows gives each unit a fixed color.
Daniel@0 124 %
Daniel@0 125 % OPTIONAL INPUT ARGUMENTS
Daniel@0 126 %
Daniel@0 127 % Note: M is the number of map units.
Daniel@0 128 % Note: if unspecified or given empty values ('' or []) default
Daniel@0 129 % values are used for optional input arguments.
Daniel@0 130 %
Daniel@0 131 % s The size scaling factors for the units
Daniel@0 132 %
Daniel@0 133 % (scalar) scalar gives each unit the same size scaling:
Daniel@0 134 % 0 unit disappears (edges can be seen as a dot).
Daniel@0 135 % 1 by default unit has its normal size (ie. no scaling)
Daniel@0 136 % >1 unit overlaps others
Daniel@0 137 % (matrix) Mx1 double: each unit gets individual size scaling
Daniel@0 138 %
Daniel@0 139 % pos Position of origin
Daniel@0 140 %
Daniel@0 141 % (vector) This argument exists to be able drawing component planes
Daniel@0 142 % in arbitrary locations in a figure. Note the operation:
Daniel@0 143 % if this argument is given, the axis limits setting
Daniel@0 144 % part in the routine is skipped and the limits setting
Daniel@0 145 % will be left to be done by MATLAB's default
Daniel@0 146 % operation.
Daniel@0 147 %
Daniel@0 148 % OUTPUT ARGUMENTS
Daniel@0 149 %
Daniel@0 150 % h (scalar) handle to the created patch object
Daniel@0 151 %
Daniel@0 152 % OBJECT TAGS
Daniel@0 153 %
Daniel@0 154 % One object handle is returned: field Tag is set to
Daniel@0 155 % 'planeC' for component plane
Daniel@0 156 % 'planeU' for U-matrix
Daniel@0 157 %
Daniel@0 158 % FEATURES
Daniel@0 159 %
Daniel@0 160 % There are some extra features in following arguments
Daniel@0 161 %
Daniel@0 162 % size
Daniel@0 163 % - MxL matrix: radial scaling: the distance between
Daniel@0 164 % the center of node m and its kth vertex is scaled by
Daniel@0 165 % s(m,k).
Daniel@0 166 % - Mx1x2 matrix: the uniform scaling is done separately for
Daniel@0 167 % x- and y-directions
Daniel@0 168 % - MxLx2 matrix: the scaling is done separately to x- and y-
Daniel@0 169 % directions for each vertex.
Daniel@0 170 %
Daniel@0 171 % color
Daniel@0 172 % Each vertex may be given individual color.
Daniel@0 173 % The PATCH object interpolates the colors on the
Daniel@0 174 % face if shading is turned to interp.
Daniel@0 175 % - 1xMxL matrix: colormap index for each vertex
Daniel@0 176 % - LxMx3 matrix: RGB color for each vertex
Daniel@0 177 %
Daniel@0 178 % Note: In both cases (size and color) the ordering of the patch
Daniel@0 179 % vertices in the "built-in" patches is the following
Daniel@0 180 %
Daniel@0 181 % 'rect' 'hexa'
Daniel@0 182 % 1 3 1
Daniel@0 183 % 2 4 5 2
Daniel@0 184 % 6 3
Daniel@0 185 % 4
Daniel@0 186 %
Daniel@0 187 % The color interpolation result seem to depend on the order
Daniel@0 188 % in which the patch vertices are defined. Anyway, it gives
Daniel@0 189 % unfavourable results in our case especially with hexa grid:
Daniel@0 190 % this is a MATLAB feature.
Daniel@0 191 %
Daniel@0 192 % EXAMPLES
Daniel@0 193 %
Daniel@0 194 % m=som_make(rand(100,4),'msize',[6 5]) % make a map
Daniel@0 195 %
Daniel@0 196 % % show the first variable plane using indexed color coding
Daniel@0 197 %
Daniel@0 198 % som_cplane(m.topol.lattice,m.topol.msize,m.codebook(:,1));
Daniel@0 199 % or som_cplane(m.topol,m.codebook(:,1));
Daniel@0 200 % or som_cplane(m,m.codebook(:,1));
Daniel@0 201 %
Daniel@0 202 % % show the first variable using different sized black units
Daniel@0 203 %
Daniel@0 204 % som_cplane(m,'k',m.codebook(:,1));
Daniel@0 205 %
Daniel@0 206 % % Show the u-matrix. First we have to calculate it.
Daniel@0 207 % % Note: som_umat returns a matrix therefore we write u(:) to get
Daniel@0 208 % % a vector which contains the values in the proper order.
Daniel@0 209 %
Daniel@0 210 % u=som_umat(m);
Daniel@0 211 % som_cplane('hexaU', m.topol.msize, u(:));
Daniel@0 212 %
Daniel@0 213 % % Show three first variables coded as RGB colors
Daniel@0 214 % % and turn the unit edges off
Daniel@0 215 %
Daniel@0 216 % h=som_cplane(m, m.codebook(:,1:3),1)
Daniel@0 217 % set(h,'edgecolor','none');
Daniel@0 218 %
Daniel@0 219 % % Try this! (see section FEATURES)
Daniel@0 220 %
Daniel@0 221 % som_cplane('rect',[5 5],'none',rand(25,4));
Daniel@0 222 % som_cplane('rect',[5 5],rand(1,25,4));
Daniel@0 223 %
Daniel@0 224 % SEE ALSO
Daniel@0 225 %
Daniel@0 226 % som_barplane Visualize the map prototype vectors as bar diagrams
Daniel@0 227 % som_plotplane Visualize the map prototype vectors as line graphs
Daniel@0 228 % som_pieplane Visualize the map prototype vectors as pie charts
Daniel@0 229 % som_umat Compute unified distance matrix of self-organizing map
Daniel@0 230 % vis_patch Define the basic patches used in som_cplane
Daniel@0 231 % som_vis_coords The default 'hexa' and 'rect' coordinates in visualizations
Daniel@0 232
Daniel@0 233 % Copyright (c) 1999-2000 by the SOM toolbox programming team.
Daniel@0 234 % http://www.cis.hut.fi/projects/somtoolbox/
Daniel@0 235
Daniel@0 236 % Version 2.0beta Johan 061099 juuso 151199 juuso 070600
Daniel@0 237
Daniel@0 238 %%% Check & Init arguments %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Daniel@0 239
Daniel@0 240 [nargin, lattice, msize, color, s, pos]=vis_planeGetArgs(varargin{:});
Daniel@0 241 error(nargchk(3, 5, nargin)); % check no. of input args is correct
Daniel@0 242
Daniel@0 243 %% Translation?
Daniel@0 244
Daniel@0 245 if nargin < 5 | isempty(pos)
Daniel@0 246 pos=NaN; % "no translation" flag
Daniel@0 247 elseif ~vis_valuetype(pos,{'1x2'}),
Daniel@0 248 error('Position of origin has to be given as an 1x2 vector.');
Daniel@0 249 end
Daniel@0 250
Daniel@0 251 %% Patchform %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Daniel@0 252
Daniel@0 253 switch class(lattice)
Daniel@0 254 case 'char' % built-in patchforms
Daniel@0 255 pos=pos-1;
Daniel@0 256 switch lattice
Daniel@0 257 case {'hexa', 'hexaU'}
Daniel@0 258 patchform=vis_patch('hexa');
Daniel@0 259 case {'rect', 'rectU'}
Daniel@0 260 patchform=vis_patch('rect');
Daniel@0 261 otherwise
Daniel@0 262 error([ 'Lattice ' lattice ' not implemented!']);
Daniel@0 263 end
Daniel@0 264 case { 'double', 'sparse'}
Daniel@0 265 if vis_valuetype(lattice,{'nx2'}),
Daniel@0 266 patchform=lattice; % users patchform
Daniel@0 267 lattice='rect';
Daniel@0 268 else
Daniel@0 269 error('Patchform matrix has wrong size');
Daniel@0 270 end
Daniel@0 271 otherwise
Daniel@0 272 error('String or matrix expected for lattice.');
Daniel@0 273 end
Daniel@0 274
Daniel@0 275 l=size(patchform,1); % number of vertices
Daniel@0 276 planeType=lattice(end); % 'U' if umatrix otherwise something else
Daniel@0 277
Daniel@0 278 if ~vis_valuetype(msize,{ '1x2', 'nx2'}),
Daniel@0 279 error('msize has to be given as 1x2 or nx2 vectors.');
Daniel@0 280 end
Daniel@0 281
Daniel@0 282 %% msize or coordinates %%%%%%%%%%%%%%%%%%%%%%%
Daniel@0 283
Daniel@0 284 if size(msize,1)>1
Daniel@0 285 % msize is coordinate matrix Nx2?
Daniel@0 286
Daniel@0 287 if planeType == 'U', % don't accept u-matrix
Daniel@0 288 error('U-matrix visualization doesn''t work with free coordinates.');
Daniel@0 289 end
Daniel@0 290
Daniel@0 291 % set number of map unit and unit coordinates
Daniel@0 292 munits=size(msize,1);
Daniel@0 293 unit_coords=msize; msize=[munits 1];
Daniel@0 294
Daniel@0 295 if isnan(pos), % no translation is done here
Daniel@0 296 pos=[0 0]; % using [0 0] in order to prevent
Daniel@0 297 end % axis tightening in
Daniel@0 298 % vis_PlaneAxisProperties (arbitary coords!)
Daniel@0 299 else
Daniel@0 300 % msize is built-in lattice
Daniel@0 301
Daniel@0 302 unit_coords=som_vis_coords(lattice,msize);
Daniel@0 303
Daniel@0 304 % Calculate matrices x and y which 'moves' nodes
Daniel@0 305 % to the correct positions:
Daniel@0 306 % For U-matrix, the size has to be recalculated
Daniel@0 307 if planeType == 'U',
Daniel@0 308 xdim=2*msize(1)-1;ydim=2*msize(2)-1;
Daniel@0 309 else
Daniel@0 310 xdim=msize(1);ydim=msize(2);
Daniel@0 311 end
Daniel@0 312 munits=xdim*ydim;
Daniel@0 313
Daniel@0 314 % Feature warning
Daniel@0 315 if munits == 3
Daniel@0 316 warning('Problems with 1x3 and 3x1 maps. See documentation.');
Daniel@0 317 end
Daniel@0 318 end
Daniel@0 319
Daniel@0 320 %% Color matrix %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Daniel@0 321
Daniel@0 322 if ~isnumeric(color) & ~ischar(color),
Daniel@0 323 error('Color matrix is invalid.');
Daniel@0 324 else
Daniel@0 325 d=size(color);
Daniel@0 326 switch length(d)
Daniel@0 327 case 2 %% Flat colors
Daniel@0 328 if ischar(color) % Check for string 'none'
Daniel@0 329 if strcmp(color,'none'),
Daniel@0 330 color=NaN;
Daniel@0 331 end
Daniel@0 332 else
Daniel@0 333 if ~(d(1)== 1 & d(2) == 3) & ...
Daniel@0 334 ~(d(1) == munits & (d(2)==1 | d(2)==3))
Daniel@0 335 error('Color data matrix has wrong size.');
Daniel@0 336 elseif d(1)~=1 & d(2)==3
Daniel@0 337 if any(color>1 | color<0)
Daniel@0 338 error('Color data matrix has invalid RGB values.');
Daniel@0 339 end
Daniel@0 340 color=reshape(color,[1 munits 3]); % RGB colors
Daniel@0 341 elseif d(2)==1
Daniel@0 342 color=color'; % indexed
Daniel@0 343 end
Daniel@0 344 end
Daniel@0 345 case 3 %% Interpolated colors
Daniel@0 346 if d(1) == 1 & d(2) == munits & d(3) == l,
Daniel@0 347 color=reshape(color, l, munits);
Daniel@0 348 elseif ~(d(1) == l & d(2) == munits & d(3) == 3)
Daniel@0 349 error('Color data matrix has wrong size.');
Daniel@0 350 end
Daniel@0 351 otherwise
Daniel@0 352 error('Color data matrix has too many dimensions.');
Daniel@0 353 end
Daniel@0 354 end
Daniel@0 355
Daniel@0 356 %% Size matrix? %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Daniel@0 357
Daniel@0 358 if nargin < 4 | isempty(s),
Daniel@0 359 s=1; % default value for s (no scaling)
Daniel@0 360 elseif ~isnumeric(s)
Daniel@0 361 error('Size matrix is not numeric.');
Daniel@0 362 end
Daniel@0 363
Daniel@0 364 %%Determine the type of size matrix
Daniel@0 365 d=size(s);
Daniel@0 366 switch length(d)
Daniel@0 367 case 2
Daniel@0 368 if (d(1)==1 & d(2)==1),
Daniel@0 369 % Each node gets the same, uniform scaling.
Daniel@0 370 s=s'; sx=s; sy=s;
Daniel@0 371 elseif (d(1)==munits & d(2)==l),
Daniel@0 372 % Each vertex is scaled radially respetc to the
Daniel@0 373 % node center.
Daniel@0 374 s=s'; sx=s; sy=s;
Daniel@0 375 elseif d(1)==munits & d(2)==1
Daniel@0 376 % Each node gets an individual uniform scaling.
Daniel@0 377 sx=repmat(s',l,1); sy=sx;
Daniel@0 378 else
Daniel@0 379 error('Size matrix has wrong size.');
Daniel@0 380 end
Daniel@0 381 case 3
Daniel@0 382 if d(1)==munits & d(2)==1 & d(3)==2,
Daniel@0 383 % Each node is individually and uniformly
Daniel@0 384 % scaled separately to x- and y-directions.
Daniel@0 385 sx=repmat(shiftdim(s(:,:,1))',l,1);
Daniel@0 386 sy=repmat(shiftdim(s(:,:,2))',l,1);
Daniel@0 387 elseif d(1)==munits & d(2)==l & d(3)==2,
Daniel@0 388 % Each vertex is scaled separately to x- and y-directions
Daniel@0 389 % with respect to the node center.
Daniel@0 390 sx=shiftdim(s(:,:,1))';
Daniel@0 391 sy=shiftdim(s(:,:,2))';
Daniel@0 392 else
Daniel@0 393 error('Size matrix has wrong size.');
Daniel@0 394 end
Daniel@0 395 otherwise
Daniel@0 396 error('Size matrix has too many dimensions.');
Daniel@0 397 end
Daniel@0 398
Daniel@0 399 % Size zero would cause division by zero. eps is as good (node disappears)
Daniel@0 400 % I tried first NaN, it works well otherwise, but the node is
Daniel@0 401 % then not on the axis and some commands may the work oddly.
Daniel@0 402 % The edge may be visible, though.
Daniel@0 403
Daniel@0 404 sx(sx==0)=eps;
Daniel@0 405 sy(sy==0)=eps;
Daniel@0 406
Daniel@0 407 % Rescale sizes for u-matrix
Daniel@0 408 if planeType=='U',
Daniel@0 409 sx=sx/2;sy=sy/2;
Daniel@0 410 end
Daniel@0 411
Daniel@0 412 %%%% Action %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Daniel@0 413
Daniel@0 414 % Making grid. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Daniel@0 415
Daniel@0 416 % Translation for each patch
Daniel@0 417
Daniel@0 418 x=repmat(unit_coords(:,1)',l,1);
Daniel@0 419 y=repmat(unit_coords(:,2)',l,1);
Daniel@0 420
Daniel@0 421 % patch vertex coordiantes
Daniel@0 422
Daniel@0 423 nx=repmat(patchform(:,1),1,munits);
Daniel@0 424 ny=repmat(patchform(:,2),1,munits);
Daniel@0 425
Daniel@0 426 % NB: The hexagons are not uniform in order to get even
Daniel@0 427 % y-coordinates for the nodes. This is handled by setting _axis scaling_
Daniel@0 428 % so that the hexa-nodes look like uniform hexagonals. See
Daniel@0 429 % vis_PlaneAxisProperties
Daniel@0 430
Daniel@0 431 %% Make and scale the final input for PATCH:
Daniel@0 432
Daniel@0 433 % 1: combine translation and scaling of each patch
Daniel@0 434 x=(x./sx+nx).*sx; y=(y./sy+ny).*sy;
Daniel@0 435
Daniel@0 436 %% 2: translation of origin (pos)
Daniel@0 437 if ~isnan(pos)
Daniel@0 438 x=x+pos(1);y=y+pos(2); % move upper left corner
Daniel@0 439 end % to pos
Daniel@0 440
Daniel@0 441 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Daniel@0 442
Daniel@0 443 %% Set axes properties
Daniel@0 444 %% Command view([0 90]) shows the map in 2D properly oriented
Daniel@0 445
Daniel@0 446 ax=newplot; % set new plot
Daniel@0 447 vis_PlaneAxisProperties(ax,lattice,msize,pos);
Daniel@0 448
Daniel@0 449 %% Draw the map!
Daniel@0 450
Daniel@0 451 if ~isnan(color)
Daniel@0 452 h_=patch(x,y,color);
Daniel@0 453 else
Daniel@0 454 h_=patch(x,y,'k'); % empty grid
Daniel@0 455 set(h_,'FaceColor','none');
Daniel@0 456 end
Daniel@0 457
Daniel@0 458 %% Set object tag
Daniel@0 459
Daniel@0 460 if planeType=='U'
Daniel@0 461 set(h_,'Tag','planeU');
Daniel@0 462 else
Daniel@0 463 set(h_,'Tag','planeC');
Daniel@0 464 end
Daniel@0 465
Daniel@0 466 %%% Build output %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Daniel@0 467
Daniel@0 468 if nargout>0, h=h_; end % Set h only,
Daniel@0 469 % if there really is output
Daniel@0 470