source: distools/plotspectrum.m @ 95

Last change on this file since 95 was 20, checked in by bduin, 13 years ago

updates for handling soft labels

File size: 1.0 KB
RevLine 
[10]1%PLOTSPECTRUM
2%
3%     h = PLOTSPECTRUM(L)
4%     h = PLOTSPECTRUM(W)
5%
6% Plot spectrum as stored in vector L or in mapping W.
7
8function [h1,h2] = plotspectrum(L)
9
10if ismapping(L)
11  if strcmp(getmapping_file(L),'psem')
12    L = getdata(L,4);
13    tit = 'Embedding Spectrum';
[20]14  elseif strcmp(getmapping_file(L),'affine') | strcmp(getmapping_file(L),'pe_em')
[10]15    try
[20]16      L = getdata(L,'eval');
[10]17      tit = 'Eigenvalues';
18    catch
19      error('No spectrum found');
20    end
21  else
22    error('No spectrum found')
23  end
24else
25  tit = 'Eigenspectrum';
26end
27
28L = flipud(sort(L(:)));
29sig1 = max(find(L>=0));
30sig2 = length(L) - sig1;
31
32if sig2 == 0
33    hh1 = plot([1:sig1],[L(1:sig1)]);
34else
35    hh1 = plot([1:sig1 sig1+0.5],[L(1:sig1);0]);
36    hold on;
37    hh2 = plot([sig1+0.5 sig1+1:sig1+sig2],[0;L(sig1+1:end)],'r');
38    hold off
39end
40V = axis;
41V(1) = -1;
42V(2) = length(L)+2;
43axis(V);
44fontsize(16);
45linewidth(2);
46xlabel('Eigenvector')
47ylabel('Eigenvalue')
48title(tit)
49if nargout > 1
50    h1 = hh1;
51    h2 = hh2;
52end
Note: See TracBrowser for help on using the repository browser.