matlab - Display an image on the X-Z plane (instead of the default X-Y) -
i can image plot on x-y plane using imagesc
, have on x-z plane further usage. there way so? thanks!
i'd use surface
instead of imagesc
:
input = [3,4,5 4,5,6]; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% figure(); zz = padarray(input,[1 1],0,'post'); % see note #2 [xx,yy] = meshgrid((1:size(input,2)+1)-0.5,(1:size(input,1)+1)-0.5); % imagesc subplot(3,1,1); imagesc(input); xlim([0 4]); ylim([0.5 2.5]); view([-50 50]); xlabel('x'); ylabel('y'); zlabel('z'); grid on; title('imagesc'); % normal (x-y): subplot(3,1,2); surface(xx,yy,0*xx,zz,'edgecolor','none','facecolor','flat'); view([-50 50]); xlabel('x'); ylabel('y'); zlabel('z'); axis ij; box on; grid on; title('x-y surface'); caxis([min(input(:)),max(input(:))]); % rotated (x-z): subplot(3,1,3); surface(xx,0*zz,yy,zz,'edgecolor','none','facecolor','flat'); view([-50 50]); xlabel('x'); ylabel('y'); zlabel('z'); axis ij; box on; grid on; title('x-z surface'); caxis([min(input(:)),max(input(:))]);
several notes:
- you might need
flipud
orfliplr
of inputs in 2ndsurface
plot (depending on how definey -> z
transition). - presentation-wise output same, but, if try compare values of nodes not same result between
x-y
,imagesc
outputs. reason surface defined using vertices, , image object defined using value in center of each square.
output:
Comments
Post a Comment