Could not set the Colormap. Reason:

Post Reply
matlab1
Site Admin
Posts: 4797
Joined: Thu Dec 15, 2016 9:30 am
Contact:

Could not set the Colormap. Reason:

Post by matlab1 »

Could not set the Colormap. Reason:
matlab1
Site Admin
Posts: 4797
Joined: Thu Dec 15, 2016 9:30 am
Contact:

Re: Could not set the Colormap. Reason:

Post by matlab1 »

solution :



A colormap is a matrix of values that define the colors for graphics objects such as surface, image, and patch objects. MATLAB® draws the objects by mapping data values to colors in the colormap.

Colormaps can be any length, but must be three columns wide. Each row in the matrix defines one color using an RGB triplet. An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. Typically, the intensities are double or single values in the range [0, 1]. A value of 0 indicates no color and a value of 1 indicates full intensity. For example, this command creates a colormap that has five colors: black, red, green, blue, and white.

Code: Select all

mymap = [0 0 0
    1 0 0
    0 1 0
    0 0 1
    1 1 1];
To change the color scheme of a visualization, call the colormap function to change the colormap of the containing axes or figure. For example, the following commands create a surface plot and set the colormap of the figure to mymap.

Code: Select all

surf(peaks)
colormap(mymap)

https://www.mathworks.com/help/matlab/ref/colormap.html
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests