Using pcolor to create a a color scale.

조회 수: 4 (최근 30일)
Justin
Justin 2012년 6월 28일
Hi all,
I made some posts a few months back about making a colour wheel. I've been able to do that using the following code.
n = 300; % number of cells
m = 220; %cells to remove for annulus ;
r = (m:n)'/n ; % radius n - m = width of the annulus
r_test = (m:n)' * 0; % 0s the radius values
r_test = r_test + 5; % adds 1 to the radius values, for uniform colors
theta = pi*(-n:n)/n; % change of colors throughout the circum of circle
X = r*cos(theta);
Y = r*sin(theta);
%C = r*cos(2*theta); % defines the color
C_test = r_test * (theta);
i = pcolor(X,Y,C_test);
set(i,'LineStyle','none');
colormap(finalrgb_scaled);
shading interp;
axis off;
Now I need to generate a vertical colour scale. It would have the same colour map as the code above, but the colours would need to be fit into a vertical bar/rectangle. I'm pretty new to matlab so I'm not sure how to change the X, Y, and C inputs for pcolor to generate a vertical rectangle. Any ideas on how to do this? I would greatly appreciate. Thanks!
Just for an idea of what I'm trying to make here, you can check out this image (the color scale on the far right).
  댓글 수: 1
Tom
Tom 2012년 6월 28일
Is there any reason why you're not just using colorbar?

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

답변 (1개)

Sean de Wolski
Sean de Wolski 2012년 6월 28일
편집: Sean de Wolski 2012년 6월 28일
Looks like a colorbar to me!

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by