rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
plot_mu_frequency.m
1 function p = plot_mu_frequency(mu_values,params)
2 %function p = plot_mu_frequency(mu_values,params)
3 %
4 % function plotting the mu_values (columnwise 2D/3D vectors) as a
5 % point distribution, the colors and size indicating the frequency
6 % of the points
7 %
8 % required fields of params:
9 % mu_names: cell array of the names of the components of mu_values
10 
11 % determine frequency vectors in a list
12 
13 % marker sizes minimum and maximum
14 mmin = 2;
15 mmax = 20;
16 
17 % eliminate possible NaN entries in list:
18 
19 while ~isempty(find(isnan(mu_values(:,1))))
20  mu_values = [mu_values(:,2:end)];
21 end;
22 
23 set_top_view = 0;
24 if (length(params.mu_names) == 2)
25  mu_values = [mu_values; zeros(1,size(mu_values,2))];
26  params.mu_names = [params.mu_names, {''}];
27  set_top_view = 1;
28 end;
29 
30 [mu_single, mu_frequency] = count_column_frequency(mu_values);
31 
32 %l = plot3(mu_values(1,:),mu_values(2,:),mu_values(3,:),'.');
33 
34 cmax = max(mu_frequency);
35 
36 %cm = jet(cmax);
37 cm = gray(cmax);
38 
39 plot_args = {};
40 pfreq = [];
41 figure;
42 for i=1:cmax
43  j = find(mu_frequency==i);
44  if ~isempty(j)
45  plot_args = [plot_args, ...
46  {mu_single(1,j)},{mu_single(2,j)},{mu_single(3, ...
47  j)},{'.'}];
48  pfreq = [pfreq, i];
49  end;
50 end;
51 % first plot all black
52 %p = plot3(plot_args{:}), hold on;
53 %for i=1:length(p)
54 % wi = (mmax*((pfreq(i)-1)/(cmax-1)) + mmin*(1-(pfreq(i)-1)/(cmax-1)))*1.1;
55 % set(p(i),'Markersize',wi,'Color',cm(1,:));
56 %end;
57 % then plot all with gray shades
58 p = plot3(plot_args{:});
59 for i=1:length(p)
60  if cmax>1
61  wi = mmax*((pfreq(i)-1)/(cmax-1)) ...
62  + mmin*(1-(pfreq(i)-1)/(cmax- 1));
63  else
64  wi = 1;
65  end;
66  set(p(i),'Markersize',wi,'MarkerFaceColor',cm(pfreq(i),:),'Marker','o',...
67  'MarkerEdgeColor',[0 0 0]);
68 end;
69 set(gca,'Box','on');
70 
71 c = colorbar;
72 colormap(cm);
73 set(c,'Limits',[0.5,cmax+0.5]);
74 c = colorbar;
75 
76 xlabel(params.mu_names{1});
77 ylabel(params.mu_names{2});
78 zlabel(params.mu_names{3});
79 
80 if set_top_view
81  view(0,90);
82 end;
83 
84 % TO BE ADJUSTED TO NEW SYNTAX
85 %| \docupdate