axis - Make axes go through origin in Matlab 3D mesh plot -
i plotting sphere in matlab using following code:
phi=linspace(0,pi,30); theta=linspace(0,2*pi,30); [phi,theta]=meshgrid(phi,theta); x=sin(phi).*cos(theta); y=sin(phi).*sin(theta); z=cos(phi); figure('units', 'pixels', ... 'position', [200 200 433 433]); colormap(copper) mesh(x,y,z,'linewidth',1.5) xlabel('k_x','interpreter','tex'); ylabel('k_y','interpreter','tex'); zlabel('k_z','interpreter','tex'); set(gca,... 'xtick' , [] , ... 'ytick' , [] , ... 'ztick' , [] , ... 'linewidth' , 1.5 ); set(gcf,... 'color','w',... 'paperpositionmode', 'auto');
as can see, plots sphere on white background, no ticks, x-, y- , z-axes.
now, want have these axes go through origin of sphere. is, want axes go through (0,0,0), , not now, on edges of box. also, want have labels positioned @ positive end of axis, if possible? maybe arrow @ end too? ... not main problem.
it feels have searched entire web simple problem...
if using matlab r2014a or other of ealier versions, here there easy use tool john barber such implementation:
Comments
Post a Comment