|
本帖最后由 meatball1982 于 2017-11-30 08:53 编辑
matlab scatter high dimensions tensor visualization
- clear all
- clc
- clf
- %% outline
- % plot tensor with value in one figure.
- %% main
- % point number --------------------------------
- n=400;
- % generate x,y,z -----------------------------
- z = linspace(0,4*pi,n)+rand(1,n)*0.2;
- x = 2*cos(z) + [1:n]/50.*rand(1,n);
- y = 2*sin(z) + [1:n]/80.*rand(1,n);
- % point properties v1,v2,...,v8 --------------
- v1 = (10*abs(z)+10).*rand(size(z));
- v2 = z + 4 ;
- v3 = sin(z/2*0.2*pi)+2;
- v4 = log(z+2);
- v5 = cos((pi*0.1*y).^0.5) +2 ;
- v6 = y+2;
- v7 = sin(pi*log(z+1))+2;
- v8 = cos(pi*log(z+1))+2;
- % plot parameter -------------------------------
- xmin= -10;xmax = 15;
- ymin= -10;ymax = 15;
- zmin= 0;zmax = 15;
- % view point ----------------------------------
- vx = -50; vy = 20;
- % fontsize ------------------------------------
- mm_fz = 12;
- % set fig size --------------------------------
- fig_pos = [0.09 0.15 0.53 0.75];
- axis_pos= [xmin xmax ymin ymax zmin zmax];
- % plot 3D points ------------------------------
- h=figure(1);
- set(h, 'Position', [100, 100, 800, 500]);
- % plot zeros plane ------------------------------
- ax1 = axes;
- set(ax1,'position',fig_pos );
- h_1 = scatter3(ax1,x,y,zeros(size(x)),3*v3,v4,'o','filled');
- box on
- hidden off
- axis(axis_pos );
- view([vx,vy])
- colormap(ax1,summer);
- xlabel('IamX')
- ylabel('IamY')
- zlabel('IamZ')
- title('IamTitle')
- % plot x plane ------------------------------
- ax2 = axes;
- set(ax2,'position',fig_pos);
- h_2 = scatter3(ax2,xmax*ones(size(x)),y,z,7*v5,v6,'s','filled');
- box off
- axis off
- hidden off
- axis(axis_pos );
- view([vx,vy])
- colormap(ax2,'pink');
- % plot y plane ------------------------------
- ax3 = axes;
- set(ax3,'position',fig_pos);
- h_3 = scatter3(ax3,x,ymax*ones(size(y)),z,8*v7,v8,'^','filled');
- box off
- axis off
- hidden off
- axis(axis_pos );
- view([vx,vy])
- colormap(ax3,'cool');
- % plot xyz ------------------------------
- ax4 = axes;
- set(ax4,'position',fig_pos);
- h_4 = scatter3(ax4,x,y,z,1.1*v1,v2,'o','filled');
- % box off
- axis off
- hidden off
- axis(axis_pos );
- view([vx,vy])
- colormap(ax4,'jet');
- % set colorbar --------------------------------
- cb1 = colorbar(ax1,'Position',[.65 .15 .05 .6]);
- cb2 = colorbar(ax2,'Position',[.74 .15 .05 .6]);
- cb3 = colorbar(ax3,'Position',[.83 .15 .05 .6]);
- cb3 = colorbar(ax4,'Position',[.92 .15 .05 .6]);
- % set fontsize --------------------------------
- set(ax1,'fontsize',mm_fz)
- set(ax2,'fontsize',mm_fz)
- set(ax3,'fontsize',mm_fz)
- set(ax4,'fontsize',mm_fz)
- h=gcf;
- fi_na=['./fig_8_val_3D'];
- % fun_work_li_035_myfig_out(h,fi_na,3);
- %% plot point properties ---------------------------
- % clf
- % sbp_width=0.8;
- % sbp_heig=0.75;
- % n_row = 4;
- % n_col = 3;
- % [out_pos]=fun_mm_subplot_pos(n_row,n_col,sbp_width,sbp_heig);
- % h=figure(2)
- % set(h, 'Position', [100, 100, 800, 600]);
- %
- % ax=axes('position',out_pos(1,:));
- % plot(x,'.')
- % title('x');
- % ax=axes('position',out_pos(2,:));
- % plot(y,'.')
- % title('y');
- % ax=axes('position',out_pos(3,:));
- % plot(z,'.')
- % title('z');
- %
- % ax=axes('position',out_pos(4,:));
- % plot(v1,'.')
- % title('v1');
- % ax=axes('position',out_pos(5,:));
- % plot(v2,'.')
- % title('v2');
- % ax=axes('position',out_pos(6,:));
- % plot(v3,'.')
- % title('v3');
- %
- % ax=axes('position',out_pos(7,:));
- % plot(v4,'.')
- % title('v4');
- % ax=axes('position',out_pos(8,:));
- % plot(v5,'.')
- % title('v5');
- % ax=axes('position',out_pos(9,:));
- % plot(v6,'.')
- % title('v6');
- %
- % ax=axes('position',out_pos(10,:));
- % plot(v7,'.')
- % title('v7');
- % ax=axes('position',out_pos(11,:));
- % plot(v8,'.')
- % title('v8');
- %
- %
- % h=gcf;
- % fi_na=['./fig_8_val_split'];
- % fun_work_li_035_myfig_out(h,fi_na,3);
- %
复制代码
|
|