I need to plot a 3D figure with each data point colored with the value of a 4th variable using a colormap. Lets say I have 4 variables X,Y,Z and W where W = f(X,Y,Z). I want
So just use z for the size vector (4th input) as well as the color vector (5th input):
z
z = 10*(1:pi/50:10*pi); y = z.*sin(z/10); x = z.*cos(z/10); figure(1) scatter3(x,y,z,z,z) view(45,10) colorbar
The size vector needs to be greater 0, so you may need to adjust your z accordingly.