3D stem plot colored by Z-value
이전 댓글 표시
Does anybody know how to vary the color of the scatter point and stem line in accordance to the Z-value for the 'stem3' plot function? Ideally the outcome of which would be similar to the purpose of 'C' for the 3D scatter plot: scatter3(X,Y,Z,S,C); where if C is a vector, its value is linearly mapped to the selected colormap. An example using the scatter3 function is:
V_dot_r = [0.027; 0.018; 0.018; 0.018; 0.0135];
V_dot_a = [2; 2; 1; 0.5; 0.5];
conv = [27, 33, 41, 50, 46];
scatter3(V_dot_r, V_dot_a, conv, 60, conv, 'filled')
colormap(cool)
colorbar
I would like to obtain a similar plot, however using the stem3 function rather than the scatter3 function. Is this possible?
Thanks in advance.
채택된 답변
추가 답변 (1개)
Doesn't look easy; there's no .CData property even using Yair's UNDOCUMENTED function to find any stem3 properties that weren't exposed by TMW.
Best I can come up with easily is an approximation --
hSt=stem3(V_dot_r, V_dot_a, conv, 'filled');
hold on
hSc=scatter3(V_dot_r, V_dot_a, conv, 60, conv, 'filled');
colormap(cool)
that will put the colors on the markers but leaves the stems in the default color -- you can change that to black, say, but not variable to match.
The alternative is to manually draw the lines for each marker after scatter.
Does seem to be a reasonable enhancement request, don't know why TMW wouldn't have included similar facility from git-go.
카테고리
도움말 센터 및 File Exchange에서 Labels and Styling에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

