ColorRamp

摘要

允许您引用 ArcGIS 工程中可用的现有色带。

说明

由于可能存在具有相同名称的多个色带,因此必须使用唯一名称在工程中创作色带。 如果存在重复名称,但您需要手动确定并测试是否存在冗余,则索引参数非常有用。

语法

ColorRamp ({color_ramp_name}, index)
参数说明数据类型
color_ramp_name

The name of the color ramp as it appears in the application. The name is not case sensitive.

String
index

The index value of the color ramp given that there may be more than one color ramp with the same name.

(默认值为 0)

Integer
返回值
数据类型说明
ColorRamp

返回 ColorRamp 对象。

代码示例

ColorRamp 示例

以下代码行将返回名称为 "Red to Yellow" 的色带。

import arcpy
cr = arcpy.mp.ColorRamp("Yellow to Red")