How to select a point on 3D plot and the same point should be highlighted in the 2D plot as well in the Matlab GUI?

I have a GUI in Matlab with two graphs. One is the 3D plot which is using the scatter3 and the 2D plot which is using gplotmatrix. Both the plots have the same x,y and z axis. I am using R2018b version.
Query 1: I want to select a point on the 3D plot and also the same point should get selected in the 2D plot. Is there any code to link both the graphs in a GUI?
Query 2: Also, when I select a point in the 3D plot, I want the lines connected from the selected point to x axis, y axis and z axis respectively. And when I select another point from the 3D plot, the previous lines should get deleted and new lines should be formed from the newly selected point to x axis, y axis and z axis respectively.

댓글 수: 4

Can you share the GUI as attachement and your codes so that we can run it and produce your plots?
Are you using AppDesigner?
Thank you for the reply Luna! The code has many excel sheets without which the code will not run. So attaching the code will not be possible. But I can surely share the screenshot of the Guide. Yes I am using the appdesigner.
Yes. I tried using ginput. But somehow the code is only working for x and y axis and not for z axis. Also, I did not get how to use it for scatter3 plot. Can you tell me the structure of the code to be used in the scatter3 plot? The below code is the code related to both the graphs (scatter3 plot and gplot matrix).
color_map = jet
a = axes(handles.panelLeft);
M=sortrows(M, [4]);
min_far= 0
max_far=max([0.5; M(:,4)]);
range_far=max_far;
step_far = range_far/(size(color_map,1)-1)
tmp_M = [];
for i =1:size(M,1)
tmp_M = [tmp_M; [M(i,:), round(M(i,4)/step_far+1)]];
end
M= tmp_M;
C=[];
M2 = [];
C2 = [];
for i =1:size(M,1)
if M(i,4) > 0.12 %threshold for filling points
C =[C;color_map(M(i,5), :)];
C2 =[C2;color_map(M(i,5),:)];
M2 = [M2; M(i,:)];
else
C =[C;color_map(M(i,5), :)];
end
end
s = scatter3(a,M(:,1),M(:,2),M(:,3),30,C,'o');
hold on
if size(M2)>0
scatter3(M2(:,1),M2(:,2),M2(:,3),30,C2,'filled');
end
xlabel("(X) Dev Area /µm^2")
ylabel("(Y) Vuse /V")
zlabel("(Z) V__ATE/V")
hold off
label=char('Dev Area /µm^2','Vuse /V','V__ATE/V');
gplotColor = []
for i =1:size(color_map,1)
if ismember(i, M(:,5))
gplotColor = [gplotColor; color_map(i, :)];
end
end
gplotmatrix(handles.panelRight,M(:,1:3),M(:,1:3),M(:,5),gplotColor,'.',10,'off',[] ,label, label);
assignin('base', 'M', M);
%colormap jet
am = axes(handles.panelmid);
axis off;
colormap jet;
caxis([min_far max_far]);
c=colorbar(am);
x=get(c,'Position');
x(3)=0.5;
set(c,'Position',x)

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 White에 대해 자세히 알아보기

질문:

2020년 3월 12일

편집:

2020년 3월 13일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by