Using pcolor to create a a color scale.
12 views (last 30 days)
Show older comments
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 Comment
Answers (1)
See Also
Categories
Find more on Colormaps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!