function P = som_order_cplanes(sM, varargin)
%SOM_ORDER_CPLANES Orders and shows the SOM component planes.
%
% P = som_order_cplanes(sM, [[argID,] value, ...])
%
% som_order_cplanes(sM);
% som_order_cplanes(sM,'comp',1:30,'simil',C,'pca');
% P = som_order_cplanes(sM);
%
% Input and output arguments ([]'s are optional):
% sM (struct) map or data struct
% (matrix) a data matrix, size * x dim
% [argID, (string) See below. The values which are unambiguous can
% value] (varies) be given without the preceeding argID.
%
% P (matrix) size n x * (typically n x 2), the projection coordinates
%
% Here are the valid argument IDs and corresponding values. The values
% which are unambiguous (marked with '*') can be given without the
% preceeding argID.
% 'comp' (vector) size 1 x n, which components to project, 1:dim by default
% 'simil' *(string) similarity measure to use
% 'corr' linear correlation between component planes
% 'abs(corr)' absolute value of correlation (default)
% 'umat' as 'abs(corr)' but calculated from U-matrices
% 'mutu' mutual information (not implemented yet)
% (matrix) size n x n, a similarity matrix to be used
% 'proj' *(string) projection method to use: 'SOM' (default),
% 'pca', 'sammon', 'cca', 'order', 'ring'
% 'msize' (vector) size of the SOM that is used for projection
% 'show' *(string) how visualization is done: 'planes' (default),
% 'names', or 'none'
% 'mask' (vector) dim x 1, the mask to use, ones(dim,1) by default
% 'comp_names' (cell array) of strings, size dim x 1, the component names
%
% The visualized objects have a callback associated with them: by
% clicking on the object, the index and name of the component are printed
% to the standard output.
%
% See also SOM_SHOW.
% Copyright (c) 2000 by the SOM toolbox programming team.
% Contributed to SOM Toolbox on June 16th, 2000 by Juha Vesanto
% http://www.cis.hut.fi/projects/somtoolbox/
% Version 2.0beta juuso 120600 070601
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% check arguments