direction of Y Axis is changing

3 views (last 30 days)
Mohannad Ajamieh
Mohannad Ajamieh on 27 May 2022
when I plot an image in point form the direction of Y Axis is changing!
how can I make 0-Y and 0_X in the same position
there is three dimention because I worke on volume image
label=I;
[X,Y,Z]=meshgrid(1:size(label,1),1:size(label,2),1:size(label,3));
label=label>0; % für logischen Eintrag
Data=label; % Für Farbeintrag
ind=Data(:)>0; % keine Null - einträge
px=X(ind);
py=Y(ind);
pz=Z(ind);
color=double(Data(ind));
%% point plot
set(gca,'YDir','normal')
plot3(px,py,pz,'.')
xlabel('X µm')
ylabel('Y µm')
zlabel('Z µm')

Answers (2)

Jonas
Jonas on 27 May 2022
calling
set(gca,'XDir','normal');
should be enough
  2 Comments
Mohannad Ajamieh
Mohannad Ajamieh on 30 May 2022
Sorry it does not work.
As you can see in the code, I already included it .......set(gca,'YDir','normal')..... and I also tried the 'reverse' but it does not work too.

Sign in to comment.


Walter Roberson
Walter Roberson on 30 May 2022
[X,Y,Z]=meshgrid(1:size(label,1),1:size(label,2),1:size(label,3));
That is incorrect. size(label,1) is the number of rows, and rows correspond to Y not to X. size(label,2) is the number of columns, and columns correspond to X not to Y.
  5 Comments
Walter Roberson
Walter Roberson on 31 May 2022
What is your current code?
Mohannad Ajamieh
Mohannad Ajamieh on 1 Jun 2022
clear all
close all
names=dir('......source folder.........');
for iii=1:size(names,1)
I(:,:,iii)=imread(strcat('........source folder..........',names(iii).name));
for j=1:size(names,1)
Img_3D=surface('XData',[0 75;0 75],'YData',[0 0;75 75],'ZData',[0.2985*j 0.2985*j;0.2985*j 0.2985*j], 'CData' ,flipdim(im2double(I(:,:,iii)),1),'FaceColor','texturemap','EdgeColor','none');
colormap(gray)
xlabel('10*x mm')
ylabel('10*y mm')
zlabel('10*z mm')
end
end
label=I;
[X,Y,Z] = meshgrid(1:size(label,2),1:size(label,1),1:size(label,3));
label=label>0; % für logischen Eintrag
Data=label; % Für Farbeintrag
ind=Data(:)>0; % keine Null - einträge
px=X(ind);
py=Y(ind);
pz=Z(ind);
color=double(Data(ind));
%% punkt plot
plot3(px,py,pz,'.')
title('punkt darstellung')
xlabel('X mm')
ylabel('Y mm')
zlabel('Z mm')

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!