rbmatlab  1.13.10
 All Classes Namespaces Files Functions Variables Groups 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 if (length(params.mu_names) == 2)
24  mu_values = [mu_values; zeros(1,size(mu_values,2))];
25  params.mu_names = [params.mu_names, {''}];
26 end;
27 
28 [mu_single, mu_frequency] = count_column_frequency(mu_values);
29 
30 %l = plot3(mu_values(1,:),mu_values(2,:),mu_values(3,:),'.');
31 
32 cmax = max(mu_frequency);
33 
34 %cm = jet(cmax);
35 cm = gray(cmax);
36 
37 plot_args = {};
38 pfreq = [];
39 figure;
40 for i=1:cmax
41  j = find(mu_frequency==i);
42  if ~isempty(j)
43  plot_args = [plot_args, ...
44  {mu_single(1,j)},{mu_single(2,j)},{mu_single(3, ...
45  j)},{'.'}];
46  pfreq = [pfreq, i];
47  end;
48 end;
49 % first plot all black
50 %p = plot3(plot_args{:}), hold on;
51 %for i=1:length(p)
52 % wi = (mmax*((pfreq(i)-1)/(cmax-1)) + mmin*(1-(pfreq(i)-1)/(cmax-1)))*1.1;
53 % set(p(i),'Markersize',wi,'Color',cm(1,:));
54 %end;
55 % then plot all with gray shades
56 p = plot3(plot_args{:});
57 for i=1:length(p)
58  if cmax>1
59  wi = mmax*((pfreq(i)-1)/(cmax-1)) ...
60  + mmin*(1-(pfreq(i)-1)/(cmax- 1));
61  else
62  wi = 1;
63  end;
64  set(p(i),'Markersize',wi,'MarkerFaceColor',cm(pfreq(i),:),'Marker','o',...
65  'MarkerEdgeColor',[0 0 0]);
66 end;
67 set(gca,'Box','on');
68 
69 c = colorbar;
70 colormap(cm);
71 set(c,'Clim',[0.5,cmax+0.5]);
72 c = colorbar;
73 
74 xlabel(params.mu_names{1});
75 ylabel(params.mu_names{2});
76 zlabel(params.mu_names{3});
77 
78 % TO BE ADJUSTED TO NEW SYNTAX
79 %| \docupdate