[未答复] 画3d图时如何设置鼠标悬浮在每一个点上的提示(默认是坐标)?

[复制链接]
AlbertW_zGIa8 发表于 2021-1-12 16:10:34
  1. clc;
  2. clear;
  3. % syms x y
  4. % y=1
  5. % x=solve(y+x==2,x)
  6. % disp(x)
  7. % global h5;
  8. global h6;
  9. h1=figure
  10. h2=axes('parent',h1,...
  11.     'unit','normalized',...
  12.     'position',[0.2,0.3,0.65,0.6],...
  13.     'box','on')
  14. % ezsurf('x^2*exp(-x^2-y^2)')
  15. x=[-5, -2.5, -2.5, -2.5, -0.5, -2.5, -0.5, -2.5, -0.5, -2.5, -0.5, -2.5, -5.5, 1.5, 1.5, -2.5, 1.5, 2.5, -0.5, -2.5, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, -2, 5.5, 25, 45, -2, 7, 31, -1.5, -1.5, -1.5, 3.5, 27.52, -1.5, -1.5, -1.5, 3.5, 24.25, -2.5, -2.5, -2.5, 8, 28, -2.5, -1.5, 9, 28, -3, -3, 10, -3.89, 7, 18, -5.24, 7, 17, 25, -6.59, 7, 17, 27, 37, -2.92, -2.92, 11, -4.49, 8, 20, -6.29, 7, 7, 18, 29, -3, 10, 20, 30, -3, 8, 17, 27, -3, -3, -3, -3, 10, 10, 10, 10, 20, 20, 20, 20, 30, 30, 30, 30, -3, -3, -3, -3, 8, 8, 8, 8, 17, 17, 17, 17, 27, 27, 27, 27]
  16. y=[21, 21, 41, 41, 61, 61, 76, 76, 92, 92, 102, 102, 119, 119, 136, 136, 153, 153, 167, 167, 28, 35, 49, 56, 85, 113, 157, 162, 173, 179, 31, 51, 66, 89.5, 101, 108, 127.5, 144.5, 84.25, 84.25, 84.25, 84.25, 60, 60, 60, 84.25, 84.25, 84.25, 84.25, 84.25, 60, 60, 60, 60, 60, 84.25, 84.25, 84.25, 84.25, 84.25, 60, 60, 60, 60, 84.25, 84.25, 84.25, 84.25, 84.25, 84.25, 84.25, 84.25, 84.25, 84.25, 84.25, 84.25, 84.25, 84.25, 84.25, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 84.25, 84.25, 84.25, 84.25, 60, 60, 60, 60, 84.25, 84.25, 84.25, 84.25, 84.25, 84.25, 84.25, 84.25, 84.25, 84.25, 84.25, 84.25, 84.25, 84.25, 84.25, 84.25, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60]
  17. z=[1151, 1141.75, 1151, 1134, 1151, 1125.1, 1151, 1124, 1151, 1122.25, 1151, 1124, 1151, 1130.5, 1151, 1130.5, 1151, 1130.5, 1151, 1138.75, 1128.13, 1120.48, 1111.2, 1102.8, 1093.5, 1106.75, 1112.5, 1112.5, 1132.5, 1144.5, 1124.05, 1108, 1098.4, 1092.7, 1096.2, 1100.53, 1109.2, 1109.2, 1088.5, 1092, 1092, 1088.5, 1094.2, 1094.2, 1094.2, 1131, 1122, 1113, 1103, 1106, 1138, 1127, 1116, 1107, 1111, 1120, 1120, 1120, 1096.3, 1096.3, 1122, 1122, 1098.5, 1098.5, 1128, 1128, 1128, 1120, 1120, 1120, 1111, 1111, 1111, 1111, 1102, 1102, 1102, 1102, 1102, 1140, 1128, 1128, 1116, 1116, 1116, 1104, 1104, 1104, 1104, 1104, 1102.2, 1102.2, 1102.2, 1102.2, 1105.2, 1105.2, 1105.2, 1105.2, 1102.2, 1102.2, 1102.2, 1102.2, 1102.2, 1102.2, 1102.2, 1102.2, 1102.2, 1102.2, 1102.2, 1102.2, 1102.2, 1102.2, 1102.2, 1102.2, 1105.2, 1105.2, 1105.2, 1105.2, 1105.2, 1105.2, 1105.2, 1105.2, 1105.2, 1105.2, 1105.2, 1105.2, 1105.2, 1105.2, 1105.2, 1105.2]
  18. type=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]

  19. % x=[0,0,1,1]
  20. % y=[0,0,0,0]
  21. % z=[0,1,0,1]
  22. subplot(1,2,1)
  23. leg=linspace(1,1,8)

  24. for ii = 1:length(x)
  25.     hold on
  26.     if type(ii)==0
  27.         res1=scatter3(x(ii),y(ii),z(ii),'r', 'fill')
  28.         
  29.     end
  30.     if type(ii)==5
  31.         res8=scatter3(x(ii),y(ii),z(ii),'g', 'fill')
  32.     end
  33.     if type(ii)==1
  34.         res2=scatter3(x(ii),y(ii),z(ii),'b', 'fill')
  35.     end
  36.     if type(ii)==2
  37.         res3=scatter3(x(ii),y(ii),z(ii),'c', 'fill')
  38.     end
  39.     if type(ii)==3
  40.         res4=scatter3(x(ii),y(ii),z(ii),'m', 'fill')
  41.     end
  42.     if type(ii)==4
  43.         res5=scatter3(x(ii),y(ii),z(ii),'y', 'fill')
  44.     end
  45.     if type(ii)==6
  46.         res6=scatter3(x(ii),y(ii),z(ii),'k', 'fill')
  47.     end
  48.     if type(ii)==7
  49.         
  50.         res7=scatter3(x(ii),y(ii),z(ii),36,[0.5,0.1,0.23], 'fill')
  51.     end
  52.    
  53. end
复制代码


您需要登录后才可以回帖 登录 | 注册

本版积分规则

相关帖子
热门教程
站长推荐
快速回复 返回顶部 返回列表