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

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