0

I am having trouble writing a script that will show shades of green and blue. A colormap needs to be created that has 30 colors (10 blue, 10 aqua, 10 green). In the image the blues will be in the first row, aquas in the second, and green in the third. I am using Matlab and I shouldn't use loops.

colors = [0.2 0.1 0.5; 0.1 .5 0.8; 0.2 0.7 0.6; 0.8 0.7 0.3; 0.9 1 0];
colormap(winter)
vec = 1:length(colors);
image(vec)
Rcodez
  • 27
  • 6
math.where
  • 13
  • 4
  • 1
    What trouble are you having? What have you tried? – L. Scott Johnson Nov 12 '19 at 18:26
  • This is an exact duplicate of https://stackoverflow.com/questions/58806345/how-do-i-create-a-colormap-with-shades-of-blue-and-gree – Cris Luengo Nov 12 '19 at 18:31
  • I have updated it with the code I have thus far. Right now, I have all shades of blue, no aqua, no green, and only 5 colors. – math.where Nov 12 '19 at 20:45
  • Does the **Bonus** section of [this answer](https://stackoverflow.com/a/54676842/8239061) using [`interp1()`](https://www.mathworks.com/help/matlab/ref/interp1.html) by @gnovice answer your question? – SecretAgentMan Feb 13 '20 at 14:21

1 Answers1

0

%this script will show shades of green and blue

colors = zeros(3,10,3);

colors(:,:,3) = [.1:.1:1;.1:.1:1; 0 0 0 0 0 0 0 0 0 0];

colors(:,:,2) = [0 0 0 0 0 0 0 0 0 0;.1:.1:1;.1:.1:1];

image(colors)

math.where
  • 13
  • 4