Using pcolor to create a a color scale.

5 visualizaciones (últimos 30 días)
Justin
Justin el 28 de Jun. de 2012
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 comentario
Tom
Tom el 28 de Jun. de 2012
Is there any reason why you're not just using colorbar?

Iniciar sesión para comentar.

Respuestas (1)

Sean de Wolski
Sean de Wolski el 28 de Jun. de 2012
Editada: Sean de Wolski el 28 de Jun. de 2012
Looks like a colorbar to me!

Categorías

Más información sobre Contour Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by