How I can change the color range of surface plot

조회 수: 8 (최근 30일)
GreenPiece
GreenPiece 2017년 12월 29일
댓글: KSSV 2017년 12월 29일
Hi everyone, I followed the answer of this question: https://ch.mathworks.com/matlabcentral/answers/5042-how-do-i-vary-color-along-a-2d-line I would like to change the range of the color in a specific range. I change the code as below but it did not work. Please suggest me a solution. Thanks!
x = 0:.05:2*pi;
y = sin(x);
z = zeros(size(x));
col = linspace(0, 255, size(x,2)); % This is the color, vary with x in this case.
% colormap([col; col; col].')
surface([x;x],[y;y],[z;z],[col;col],...
'facecol','no',...
'edgecol','interp',...
'linew',2);

답변 (1개)

KSSV
KSSV 2017년 12월 29일
doc caxis
  댓글 수: 4
GreenPiece
GreenPiece 2017년 12월 29일
It is not full range color RGB, there is no red color in the result. That why I want to modify the command to get the full range of colors.
KSSV
KSSV 2017년 12월 29일
Ok....do interpolation of size 255 to 126.

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

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by