pcshow - rescale axes on 3D pointcloud display
2 views (last 30 days)
Show older comments
I'd like to rescale the axes shown from pcshow. See attached screeshot. I'd like to input some argument into the pcshow function so as to avoid manually rescaling the axes each time if possible.
Thank you :)
0 Comments
Answers (2)
Gonçalo Moreira
on 25 Aug 2021
hey, you have to modify the DataAspectRatio property of the point cloud object, which defaults to [1 1 1]!
Here's an example on how to make all axis equal:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all; close all;
% Random point cloud with 1000 (x, y, z) triplets with a dimension of roughly 30x10x5
mat = [round(30*randn(1000,1)),round(10*randn(1000,1)),round(5*randn(1000,1))];
% Show point cloud
ax = pcshow(mat)
% Normalize the data relative to the Y axis
ax.DataAspectRatio = [diff(ax.XLim), diff(ax.YLim), diff(ax.ZLim)] / diff(ax.YLim);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Hope it helps!
See Also
Categories
Find more on Point Cloud Processing 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!