Creating a colormap (matlab) with 30 colors

瘦欲@ 提交于 2019-12-25 17:38:07

问题


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)


回答1:


%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)



来源:https://stackoverflow.com/questions/58824524/creating-a-colormap-matlab-with-30-colors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!