I have a script that changes the symbology to unique values, but I can't figure out how to adjust the width?

#isolate the symbology of the selected layer
sym = lyr.symbology #set the symbology as unique values
#specify the desired fields for the symbolizing
sym.renderer.fields = ['Attribute']
#select a colour ramp
colorRamp = aprx.listColorRamps("Voxel Tracks")[0]
#set the colour ramp
sym.renderer.colorRamp = colorRamp
#update the layer symbology
lyr.symbology = sym
symbol = lyr.symbology

1 Answer 1


Checkout the Esri docs for Python CIM here.

I'm assuming it's ArcGIS Pro and version 3.0+

Here is an example. The definition described below is like JSON. I reccommmend setting symbology manually and then saving as a lyrx file, open this lyrx with a notepad and you can see the definition (under renderer)

## get the definition, like JSON. 
cim_lyr = lyr.getDefinition('V3')

## access the classes for the grouped symbology
group_classes = cim_lyr.renderer.groups[0].classes

## for each symbology class
for group_class in group_classes:
    ## access the symbology
    symb = group_class.symbol.symbol.symbolLayers[0]
    ## set the width to whatever number you want here
    symb.width = 4

## update the definition
  • 1
    Arc 2.9 and changing it to ('V2') everything worked, thank you!
    – Davec433
    Nov 27, 2023 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.