Mohammad
Mohammad

Reputation: 161

plot3 for display three dimension data in matlab

i want using plot3 for display three dimension data. size of data is (400*3) that contain two class. size of class A is 300 and size of class B is 100. but after run this code z axis is not showing. please guide me.

Fspace = rand(400,3);
figure;hold on;
plot3(Fspace(1:300,1),Fspace(1:300,2),Fspace(1:300,3),'b*');
plot3(Fspace(301:400,1),Fspace(301:400,2),Fspace(301:400,3),'ro');
legend('Class A','Class B');
% axis equal;
xlabel('x');
ylabel('y');
zlabel('z');
title('original data');

Upvotes: 1

Views: 48

Answers (1)

Alexander Vandenberghe
Alexander Vandenberghe

Reputation: 312

the z-axis is there, you're just looking from the top down. add view(3) to the end of your code to change the viewpoint to the default 3d viewpoint (no idea why it's not like that by default)

Upvotes: 3

Related Questions