Mathematica中文论坛-非官方

标题: 豆粑粑 matlab scatter high dimensions tensor visualization, multi colorbar [打印本页]

作者: meatball1982    时间: 2017-8-29 15:31
标题: 豆粑粑 matlab scatter high dimensions tensor visualization, multi colorbar
本帖最后由 meatball1982 于 2017-11-30 08:53 编辑

matlab scatter high dimensions tensor visualization





  1. clear all
  2. clc
  3. clf

  4. %% outline
  5. % plot tensor with value in one figure.

  6. %% main

  7. % point number --------------------------------
  8. n=400;         
  9. % generate x,y,z  -----------------------------
  10. z = linspace(0,4*pi,n)+rand(1,n)*0.2;
  11. x = 2*cos(z) + [1:n]/50.*rand(1,n);
  12. y = 2*sin(z) + [1:n]/80.*rand(1,n);

  13. % point properties v1,v2,...,v8  --------------
  14. v1 = (10*abs(z)+10).*rand(size(z));
  15. v2 = z + 4  ;
  16. v3 = sin(z/2*0.2*pi)+2;
  17. v4 = log(z+2);
  18. v5 = cos((pi*0.1*y).^0.5) +2  ;
  19. v6 = y+2;
  20. v7 = sin(pi*log(z+1))+2;
  21. v8 = cos(pi*log(z+1))+2;

  22. % plot parameter -------------------------------
  23. xmin= -10;xmax = 15;
  24. ymin= -10;ymax = 15;
  25. zmin=  0;zmax = 15;

  26. % view point ----------------------------------
  27. vx = -50; vy = 20;

  28. % fontsize ------------------------------------
  29. mm_fz = 12;

  30. % set fig size --------------------------------
  31. fig_pos = [0.09 0.15 0.53 0.75];
  32. axis_pos= [xmin xmax ymin ymax zmin zmax];

  33. % plot 3D points ------------------------------
  34. h=figure(1);
  35. set(h, 'Position', [100, 100, 800, 500]);

  36. % plot zeros plane ------------------------------
  37. ax1 = axes;
  38. set(ax1,'position',fig_pos );
  39. h_1 = scatter3(ax1,x,y,zeros(size(x)),3*v3,v4,'o','filled');
  40. box on
  41. hidden off
  42. axis(axis_pos );
  43. view([vx,vy])
  44. colormap(ax1,summer);
  45. xlabel('IamX')
  46. ylabel('IamY')
  47. zlabel('IamZ')
  48. title('IamTitle')


  49. % plot x plane ------------------------------
  50. ax2 = axes;
  51. set(ax2,'position',fig_pos);
  52. h_2 = scatter3(ax2,xmax*ones(size(x)),y,z,7*v5,v6,'s','filled');
  53. box off
  54. axis off
  55. hidden off
  56. axis(axis_pos );
  57. view([vx,vy])
  58. colormap(ax2,'pink');


  59. % plot y plane ------------------------------
  60. ax3 = axes;
  61. set(ax3,'position',fig_pos);
  62. h_3 = scatter3(ax3,x,ymax*ones(size(y)),z,8*v7,v8,'^','filled');
  63. box off
  64. axis off
  65. hidden off
  66. axis(axis_pos );
  67. view([vx,vy])
  68. colormap(ax3,'cool');

  69. % plot xyz  ------------------------------
  70. ax4 = axes;
  71. set(ax4,'position',fig_pos);
  72. h_4 = scatter3(ax4,x,y,z,1.1*v1,v2,'o','filled');
  73. % box off
  74. axis off
  75. hidden off
  76. axis(axis_pos );
  77. view([vx,vy])
  78. colormap(ax4,'jet');

  79. % set colorbar --------------------------------
  80. cb1 = colorbar(ax1,'Position',[.65  .15 .05 .6]);
  81. cb2 = colorbar(ax2,'Position',[.74  .15 .05 .6]);
  82. cb3 = colorbar(ax3,'Position',[.83   .15 .05 .6]);
  83. cb3 = colorbar(ax4,'Position',[.92   .15 .05 .6]);

  84. % set fontsize --------------------------------
  85. set(ax1,'fontsize',mm_fz)
  86. set(ax2,'fontsize',mm_fz)
  87. set(ax3,'fontsize',mm_fz)
  88. set(ax4,'fontsize',mm_fz)


  89. h=gcf;
  90. fi_na=['./fig_8_val_3D'];
  91. % fun_work_li_035_myfig_out(h,fi_na,3);

  92. %% plot point properties ---------------------------
  93. % clf
  94. % sbp_width=0.8;
  95. % sbp_heig=0.75;
  96. % n_row = 4;
  97. % n_col = 3;
  98. % [out_pos]=fun_mm_subplot_pos(n_row,n_col,sbp_width,sbp_heig);
  99. % h=figure(2)
  100. % set(h, 'Position', [100, 100, 800, 600]);
  101. %
  102. % ax=axes('position',out_pos(1,:));
  103. % plot(x,'.')
  104. % title('x');
  105. % ax=axes('position',out_pos(2,:));
  106. % plot(y,'.')
  107. % title('y');
  108. % ax=axes('position',out_pos(3,:));
  109. % plot(z,'.')
  110. % title('z');
  111. %
  112. % ax=axes('position',out_pos(4,:));
  113. % plot(v1,'.')
  114. % title('v1');
  115. % ax=axes('position',out_pos(5,:));
  116. % plot(v2,'.')
  117. % title('v2');
  118. % ax=axes('position',out_pos(6,:));
  119. % plot(v3,'.')
  120. % title('v3');
  121. %
  122. % ax=axes('position',out_pos(7,:));
  123. % plot(v4,'.')
  124. % title('v4');
  125. % ax=axes('position',out_pos(8,:));
  126. % plot(v5,'.')
  127. % title('v5');
  128. % ax=axes('position',out_pos(9,:));
  129. % plot(v6,'.')
  130. % title('v6');
  131. %
  132. % ax=axes('position',out_pos(10,:));
  133. % plot(v7,'.')
  134. % title('v7');
  135. % ax=axes('position',out_pos(11,:));
  136. % plot(v8,'.')
  137. % title('v8');
  138. %
  139. %
  140. % h=gcf;
  141. % fi_na=['./fig_8_val_split'];
  142. % fun_work_li_035_myfig_out(h,fi_na,3);
  143. %
复制代码








欢迎光临 Mathematica中文论坛-非官方 (http://ilovemathematica.com/) Powered by Discuz! X3.2