Reputation: 213
Hello I would like to display an axis centered on [0,0,0] of a scatter 3 plot.
Is there a way to do this using the line function?
http://au.mathworks.com/help/matlab/ref/line.html
Not quite sure how to interpret it. Would greatly appreciate a hand.
Upvotes: 0
Views: 315
Reputation: 1275
If you just need the axes try adding:
hold on;
line(xlim,[0,0],[0,0]);
line([0,0],ylim,[0,0]);
line([0,0],[0,0],zlim);
After your scatter plot.
EDIT:
If you want to place the axes with origin at another point, you can do as follows:
hold on;
line(xlim,[origin(2),origin(2)],[origin(3),origin(3)]);
line([origin(1),origin(1)],ylim,[origin(3),origin(3)]);
line([origin(1),origin(1)],[origin(2),origin(2)],zlim);
Where origin
is the point where you want the axes to meet.
Upvotes: 1