colormap
查看并设置当前的colormap
句法
colormap图
菌落(map)
菌落(目标,,,,map)
cmap =colormap
cmap =菌落(目标)
Description
Examples
更改图形的结肠
Create a surface plot and set the colormap towinter
。
figure surf(peaks) colormapwinter
将colormap设置为默认
首先,将当前图的菌落图更改为summer
。
figure surf(peaks) colormapsummer
现在将ColorMap设置回系统的默认值。如果尚未指定其他默认值,则默认colormap为戒律
。
colormap默认
Use Different Colormaps for Each Axes in Figure
Create a figure with two subplots and store the axes handles,AX1
andAX2
。通过将轴手柄传递到colormap
功能。In the upper subplot, create a surface plot using the春天
结肠。In the lower subplot, create a surface plot using thewinter
结肠。
figure ax1 = subplot(2,1,1); surf(peaks) colormap(ax1,spring) ax2 = subplot(2,1,2); surf(peaks) colormap(ax2,winter)
Specify Number of Colors for Colormap
通过将整数作为输入参数传递给内置的colormap,指定colormap中使用的颜色数量。使用Parula Colormap中的五种颜色。
图网(峰)结肠(Parula(5))
Create Custom Colormap
通过定义0.0至1.0之间的三列矩阵来创建自定义colormap。每行定义了三元素RGB三重态。第一列指定红色强度。第二列指定绿色强度。第三列指定蓝色强度。
Use a colormap of blue values by setting the first two columns to zeros.
map = [0, 0, 0.3 0, 0, 0.4 0, 0, 0.5 0, 0, 0.6 0, 0, 0.8 0, 0, 1.0]; figure surf(peaks) colormap(map)
Return Colormap Values Used in Plot
Create a surface plot of thepeaks
功能并指定一个菌落。
图网(峰)菌落(秋季(5))
返回定义图中使用的颜色的值的三列矩阵。每一行都是RGB三重态值,它指定了Colormap的一种颜色。
cmap =colormap
cmap =1。0000001。0000 0.2500 0 1.0000 0.5000 0 1.0000 0.7500 0 1.0000 1.0000 0
返回特定轴的结肠值
Return the colormap values for a specific axes by passing its axes handle to thecolormap
功能。
创建一个带有两个子图的图形,然后返回轴手柄,AX1
andAX2
。在每个轴上添加一个填充的轮廓图,并为每个轴使用不同的菌落。
figure ax1 = subplot(2,1,1); contourf(peaks) colormap(ax1,hot(8)) ax2 = subplot(2,1,2); contourf(peaks) colormap(ax2,pink)
通过传递其轴手柄,返回上部子图中使用的结肠值AX1
,到colormap
功能。每一行都是RGB三重态值,它指定了Colormap的一种颜色。
cmap =菌落(AX1)
cmap =0.3333 0 0 0.6667 0 0 1.0000 0 0 0 1.0000 0.3333 0 1.0000 0.6667 0 1.0000 1.0000 0 1.0000 1.0000 1.0000 0.5000 1.0000 1.0000 1.0000 1.0000 1.0000
用图像更改图形的结肠
Load the脊柱
返回图像的数据集X
and its associated colormapmap
。DisplayX
using the图片
function and set the colormap tomap
。
加载脊柱图图像(x)colormap(地图)
Input Arguments
map
-颜色map for new color scheme
colormap name|three-column matrix of RGB triplets|'default'
颜色map for the new color scheme, specified as a colormap name, a three-column matrix of RGB triplets, or'default'
。A colormap name specifies a predefined colormap with the same number of colors as the current colormap. A three-column matrix of RGB triplets specifies a custom colormap. You can create the matrix yourself, or you can call one of the predefined colormap functions to create the matrix. For example,菌落(戒律(10))
集的colormap the current figure to a selection of 10 colors from the戒律
结肠。
一个值'default'
将colormap设置为目标对象的默认colormap。
颜色map Name
下表列出了预定义的菌落。
颜色map Name | 颜色Scale |
---|---|
戒律 |
|
喷射 |
|
HSV |
|
热的 |
|
cool |
|
春天 |
|
summer |
|
秋天 |
|
winter |
|
灰色的 |
|
骨 |
|
铜 |
|
pink |
|
线 |
|
Colorcube |
|
prism |
|
flag |
|
白色的 |
|
Three-Column Matrix
要创建自定义colormap,请指定map
as a three-column matrix of RGB triplets where each row defines one color. An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range[0,1]
。For example, this matrix defines a colormap containing five colors.
MAP = [0.2,0.1,0.5 0.1,0.5,0.8 0.2,0.7,0.6 0.8,0.7,0.7,0.3 0.9,1,0];
This table lists the RGB triplet values for common colors.
颜色 | RGB三胞胎 |
---|---|
黄色 | [1,1,0] |
magenta | [1,0,1] |
cyan | [0,1,1] |
红色的 | [1,0,0] |
绿色 | [0,1,0] |
蓝色的 | [0,0,1] |
白色的 | [1,1,1] |
黑色的 | [0,0,0] |
数据类型:char
|double
目标
-Target
数字
目的|Axes
目的|极性
目的|图形对象
目标,指定为以下值之一:
数字
目的。The figure colormap affects plots for all axes within the figure.Axes
目的or极性
目的。You can define a unique colormap for the different axes within a figure.Graphics object that has a
颜色map
property. For example, you can change or query the colormap for aHeatmapChart
目的。
输出参数
cmap
- 结肠值
three-column matrix of RGB triplets
颜色map values, returned as a three-column matrix of RGB triplets. Each row of the matrix defines one RGB triplet that specifies one color of the colormap. The values are in the range [0, 1].
更多关于
什么是菌落?
colormap是在0
and1
这定义了图形对象(例如表面,图像和补丁对象)的颜色。MATLAB®通过将数据值映射到colormap中的颜色来绘制对象。
颜色maps 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. The intensities must be in the range [0, 1]. A value of0
indicates no color and a value of1
表示完全强度。例如,此命令创建一个具有五种颜色的菌落:黑色,红色,绿色,蓝色和白色。
myMap = [0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 1 1];
To change the color scheme of a visualization, call thecolormap
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 tomymap
。
surf(peaks) colormap(mymap)
Tips
要控制菌落的限制,以及这些限制与数据范围之间的关系,请使用
caxis
功能。
Introduced before R2006a
MATLABCommand
您单击了与此MATLAB命令相对应的链接:
通过在MATLAB命令窗口中输入该命令。Web浏览器不支持MATLAB命令。金宝app
Select a Web Site
选择一个网站以获取可用的翻译内容,并查看本地事件和优惠。根据您的位置,我们建议您选择:。
You can also select a web site from the following list:
如何获得最佳网站性能
选择中国网站(中文或英语)以获得最佳场地性能。其他Mathworks乡村网站未针对您所在的访问进行优化。
Americas
- América Latina(Español)
- Canada(English)
- United States(English)