Scatterplot colorise, cloud to cloud insted of ground
2 views (last 30 days)
Show older comments
Malte on 19 May 2015
Commented: Malte on 28 May 2015
I have two point clouds, where i want to visualize how they fit together. Therefore i want the points in one of the clouds, to go from green to red, doing to the pointdistance to the correlating point in the oppesite cloud. I have worked with Scatter3, but it colorises the cloud in respect to the Z ground, is it possible to do this in respect to the other clout, instead of the ground
Nalini Vishnoi on 20 May 2015
It is possible to represent the second point cloud using the colors corresponding to its distance from the first point cloud using scatter3. Here is a short example:
>> P1 = rand(1000,3); % Create two point clouds
>> P2 = rand(1000,3);
% find the distance betweeon point clouds
>> d = sqrt((P1(:,1)-P2(:,1)).^2 + (P1(:,2)-P2(:,2)).^2 + (P1(:,3)-P2(:,3)).^2);
>> figure, scatter3(P1(:,1), P1(:,2), P1(:,3));
>> hold on;
>> scatter3(P2(:,1), P2(:,2), P2(:,3),50, d);
Please note that you can change the colormap to any of the desired colormaps, for example, if you want the colors to change from green to yellow, you can use 'summer' colormap.
I hope this helps.
Find more on Scatter 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!