Select to view content in your preferred language

How to use Random Basic for UniqueValueRenderer in Python for ArcGIS Pro

438
2
03-29-2023 09:22 AM
by Anonymous User
Not applicable

I am using the arcpy code from How To: Sort unique value symbology classes using values from a second field in ArcGIS Pro (esri.com....  Instead of using the colorRamp, how do I use a color scheme such as "Random Basic" that is available in the symbology pane in ArcGIS Pro? I am symbolizing lines and sorting routes by their importance using another field other than the one I want to use for the symbol label.

Please point me to the reference page(s).  Thank you.

0 Kudos
2 Replies
by Anonymous User
Not applicable

That method, p.listColorRamps() gets all colors that are in the project if you remove the wildcard.  From there, you can see the names of available color styles:

colors = p.listColorRamps()

for color in colors:
    print(f'color name: {color.name}')

...
color name: Accent (8 Classes)
color name: Aspect
color name: Basic Random
color name: Bathymetric Scale
color name: Bathymetry #1
color name: Bathymetry #2
color name: Bathymetry #3
color name: Bathymetry #4
...

Your basic random is listed there... but since you are  you should be able to just use 'Basic Random'

colorRamp = p.listColorRamps("Basic Random")[0]

 

LoriEmersonKDOT
New Contributor II

That worked.  Thanks!

0 Kudos