How to set color gradient based on z axis?

19 次查看(过去 30 天)
Hi, I have this 3d scatter plot wher right now the color gradient is done by default and is being done in order of rows of data in the table, I was wondering if I can do the color gradient based on the z-axis values (like high to low)? Thanks!
hSc3 = scatter3(T.CED(ix),T.r(ix),T.E0(ix),'filled');
xlabel('ln(CED) (Pa)','fontweight','bold');
ylabel('Atomic Radius (pm)','fontweight','bold');
zlabel('E0 (V)','fontweight','bold');
NNZ = nnz(ix);
C = jet(NNZ);
hSc3.CData = C;
%T(ix,:)
hold on % don't let added stuff wipe out what we've already got drawn
hL=plot(nan(2,NNZ),'o');
set(hL,{'MarkerFaceColor'},num2cell(C,2),{'MarkerEdgeColor'},num2cell(C,2));
hLg=legend(hL,T.Element(ix));

回答(1 个)

Adam Danz
Adam Danz 2023-4-30
hSc3 = scatter3(T.CED(ix),T.r(ix),T.E0(ix),36,T.E0(ix),'filled');

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

产品


版本

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by