Assign Values to Breaks in Graduated Colors Symbology - ArcGIS Pro

720
4
01-10-2018 07:50 AM
Business_IntelligenceSoftware
Occasional Contributor

In ArcMap you could assign values to each break within a layer's graduated color symbology using classBreakValues and classBreakLabels (A code sample of this can be seen on this page http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-mapping/graduatedcolorssymbology-class.htm).

However, I have now transitioned over to ArcGIS Pro and since the ArcPy between Map and Pro are different I can't figure out how to assign values to each break within a layer's graduated color symbology. 

At first I thought that the ClassBreak (https://pro.arcgis.com/en/pro-app/arcpy/mapping/classbreak-class.htm) would accomplish what I'm looking for but once I looked at the sample code I don't think it will. 

Is it possible to assign values to each break within a layer's graduated color symbology in ArcGIS Pro?

Am I correct in thinking that the ClassBreak will not accomplish what I'm trying to do?

0 Kudos
4 Replies
DanPatterson_Retired
MVP Esteemed Contributor
Business_IntelligenceSoftware
Occasional Contributor

GraduatedColorsRenderer looks more like something to adjust the actual color of the symbology. I want to be able to say something along the lines of --- there are 3 breaks --- break one = 4, break two = 7, break three = 15 (in Python code obviously)

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

all in the same area that I pointed to... you may have to poke around in the classes yourself since ma became mapping and some of the functionality/classes moved and/or were renamed

ie http://pro.arcgis.com/en/pro-app/arcpy/mapping/graduatedsymbolsrenderer-class.htm

http://pro.arcgis.com/en/pro-app/arcpy/mapping/classbreak-class.htm

sorry, I don't make maps very often

Business_IntelligenceSoftware
Occasional Contributor

I have made some progress from my original question. I now have some code that will assign a value to the first break in the symbology, and then tell the following breaks what number they should be equal to, based on the factor of increase I choose. For example I can tell the first break to be equal to 3 and the following breaks to be increases of 7; so the next two breaks would have values of 10 and 17. However, I still want to be able to assign random numbers to each break and cant figure out how.

Here is the code I have so far:

import arcpy, os, sys, locale
p = arcpy.mp.ArcGISProject("Current")
m = p.listMaps("Map")[0]
l = m.listLayers("ProvEPOSigNet_ZIPs")[0]
sym = l.symbology
sym.renderer.classificationField = "SUM_USER_Patient_Count"
sym.renderer.breakCount = 3

breakVal = 2

for brk in sym.renderer.classBreaks:
   brk.upperBound = breakVal
   brk.label = "\u2264" + str(locale.format("%d", breakVal, grouping=True))
   breakVal +=8
l.symbology = sym

0 Kudos