Specify 3D axis origins to begin on the centre of surface plot ?
30 views (last 30 days)
Show older comments
Hi,
I have a 3D surface plot of a sphere that i produced using a text file containing x, y, z coordinates.
However, currently the axis appears at the bottom of the sphere.
I was wondering if it is possible to move the origin [0,0,0] of the X, Y, Z axis to cross at the centre of the sphere ?
I have attached a screenshot of the current plot.
I am quite new to MATLAB so any help is appreciated. Thank you!
0 Comments
Answers (2)
Image Analyst
on 4 Jan 2016
Try this:
[x, y, z] = ellipsoid(0,0,0,5.9,3.25,3.25,30);
figure
surf(x, y, z)
axis equal
xl = xlim()
yl = ylim()
zl = zlim()
hold on;
line(2*xl, [0,0], [0,0], 'LineWidth', 3, 'Color', 'k');
line([0,0], 2*yl, [0,0], 'LineWidth', 3, 'Color', 'k');
line([0,0], [0,0], 2*zl, 'LineWidth', 3, 'Color', 'k');
3 Comments
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!