3D scatter plot with 4D data

后端 未结 2 1134
没有蜡笔的小新
没有蜡笔的小新 2020-12-07 05:32

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

2条回答
  •  感情败类
    2020-12-07 05:56

    So just use z for the size vector (4th input) as well as the color vector (5th input):

    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.

    enter image description here

提交回复
热议问题