How to set a color (for Z-values) in a 3-D mesh?

조회 수: 4 (최근 30일)
SGUNITN
SGUNITN 2020년 12월 16일
댓글: SGUNITN 2020년 12월 16일
I generated a 2-D matrix having 3 columns representing 3 different features. It can be more as well.
Mesh generates a 3-D plot and assign color for each column itself.
Please suggest, if a unique color can be assigned for each column. For instance, col1 ploted in red, col2 ploted in blue, col3 ploted in green.
col1 = randi([11, 20], 60, 1);
col2 = randi([21, 30], 60, 1);
col3 = randi([101, 120], 60, 1);
input = horzcat(col1, col2, col3);
figure;
h = mesh(input);
set(h, 'facecolor', 'none', 'Marker','.', 'MarkerSize', 10, 'LineStyle', 'none');
grid on;
xlim([0 4]), zlim([0 200]);
  댓글 수: 1
SGUNITN
SGUNITN 2020년 12월 16일
At last, I got it.
Rows = 1:1:60;
Cols = 1:1:3;
[X, Clr] = ndgrid(Rows, Cols);
h = mesh(input, Clr);

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by