Built in colormaps in Matlab

核能气质少年 提交于 2019-12-14 02:11:31

问题


I want a lighter version of the "cyan" color, using the function colormap('cyan'). How do you do this?


回答1:


Check out the function BRIGHTEN:

X = spiral(8);
image(X)
colormap(winter), colorbar
brighten(0.6)

Another trick is to right click on the colorbar and select Interactive Colormap Shift, this allows to shift the color-to-data mapping using mouse dragging.




回答2:


Pure cyan is represented by the RGB triple [0 1 1]. To make it lighter, just increase the red component (ex: [0.5 1 1]), thus moving it closer to pure white ([1 1 1]). If you want to make a colormap that spans from pure cyan through lighter shades of cyan all the way to pure white, you can do the following:

nValues = 128;  %# The number of unique values in the colormap
map = [linspace(0,1,nValues)' ones(nValues,2)];  %'# 128-by-3 colormap

Now you can set the colormap to the one made above using the COLORMAP function:

colormap(map);

For more discussion of colors in MATLAB, check out this link.




回答3:


For me colormap('cyan') fails because cyan is undefined.

However, you can create your own colors easily. If cyan is equivalent to [0,1,1] a lighter color would be [0,1,1] + [.1,0,0] = [.1,1,1] or rather just increase the R in RGB to increase the luminosity.



来源:https://stackoverflow.com/questions/2785717/built-in-colormaps-in-matlab

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