Or you can customize the color mapping matrix
e.g.
map =[1
0
0;0
1
0;0
0
1];%There are only three primary colors in this color table
colormap(map)
Additionally, the functions defined above can specify the number of colors. For example, gray(100) generates 100 gradient colors from black to white, gray(128) generates 128 colors, and the default value is 256 colors. For example, colormap(gray(32)) is 32 colors of grayscale.