# Controlling how Preset Color Ramps are applied to layers in ArcMap using ArcPy?

In ArcMap Style Manager, I have a Preset Color Ramp defined. I would like to control how the colors are applied when doing Add All Values, but it seems colors in the set are applied at random and differently in ArcMap and with arcpy.mapping.

When I apply the ramp from ArcMap, Layer Properties, Symbology, Add All Values, these are the results:

When I apply the ramp using arcpy.mapping and lyr.symbology.addAllValues(), these are the results:

It is a totally different set of colors, the orange from the first image and brown from the second are different. I have a Python automated map export process and I would like some consistency in how colors are applied for this layer.

Does anyone have a way to make this more consistent?

Here is the code snippet:

templateMxd = r'D:\...\biodiv_npc_map.mxd'
mxd = arcpy.mapping.MapDocument(templateMxd)
df = arcpy.mapping.ListDataFrames(mxd)[0]
lyrList = arcpy.mapping.ListLayers(mxd, "*", df)
for lyr in lyrList:
if lyr.name == "Mapped Native Plant Communities near or on property":

• I still cannot see how do you apply a particular ramp using arcpy code. Don't you need to update the symbology using .lyr file for which a color ramp is defined? – Alex Tereshenkov Feb 17 '17 at 7:41
• You can also run addAllValues() on a layer that is already part of an existing MXD, which is what my script does. The properties for the layer are as defined in the screen cap of the Layer Properties window above and are saved in biodiv_npc_map.mxd. – jeffreinhart Feb 18 '17 at 16:57
• You can create a source layer and use it as a template. support.esri.com/en/technical-article/000012251 – BBG_GIS Nov 23 '17 at 0:02

lyr1 = "layer_1"