G Gr
G Gr

Reputation: 6080

Wire frame and Y-Z view in matlab

When plotting data in matlab I noticed that I constantly have to use the rotate button to go to the Y-Z view. I was wondering if I can automate this, so it comes out in that view first?

The method I currently use:

%% plot data+clusters
figure, hold on
scatter3(data(:,1),data(:,2),data(:,3), 5, clustIDX, 'filled')
scatter3(clusters(:,1),clusters(:,2),clusters(:,3), 100, (1:K)', 'filled')
hold off, xlabel('x'), ylabel('y'), zlabel('z')

I was also wondering how you set the wire frame in the background, looking at the documentation Im not sure if its just called mesh?

Upvotes: 1

Views: 948

Answers (2)

Ansari
Ansari

Reputation: 8218

For the first item, do the rotation once manually and run this line to find out your desired azimuth and elevation:

[az, el] = view;

for the figure you want. Then jot down the values you get and in your code, call

view([-90 15]);

assuming -90 and 15 were the values you got.

For the second item, just type grid on to see the "wireframe" in the background.

Upvotes: 2

trumpetlicks
trumpetlicks

Reputation: 7065

Look here, it talks about rotation of a graphics object in 3 space!!!

http://www.mathworks.com/help/techdoc/ref/rotate.html

Upvotes: 0

Related Questions