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?

6 ビュー (過去 30 日間)
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 件のコメント
Irene Eliza Thomas
Irene Eliza Thomas 2020 年 3 月 13 日
編集済み: Irene Eliza Thomas 2020 年 3 月 13 日
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 件)

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by