Matlab or Origin - Combining two sets of 3D data in one contour plot

546 Views Asked by At

I have two sets of 3D data with XYZ coordinates. I would like to know if there is a program that can combine the two, such that:

One set of data is represented by the colours of the plot, and the other set of data is represented by the height (in 3D) of the plot.

I am familiar with both Matlab and Origin.

2

There are 2 best solutions below

0
On

Can be done with surf(Z,C).

a = randi(20,20,20);
b = randi(20,20,20);

figure;
subplot(2,2,1);
surf(a);
title('Height');

subplot(2,2,2);
surf(b);
title('Color');

subplot(2,2,[3,4]);
surf(a,b);
title('Mixed');

Not the best representations but you can see one matrix yields height and one yields color.

Color of mixed plot comes from right plot

Color matches

Height of mixed plot comes from left plot

Height matches

0
On

It is easy if you use scatter3 function.

w=100;
x1=rand(1,w);
y1=rand(1,w);
z1=rand(1,w)*100;
z2=ceil(rand(1,w)*255);
figure
h=scatter3(x1,y1,z1,ones(1,w)*50,z2,'filled');

enter image description here