ClassBreak

Summary

The ClassBreak class represents a class break that is available to the GraduatedColorsRenderer and the GraduatedSymbolsRenderer classes.

Discussion

It provides access to individual class break properties such as label, description, and upperBound and to the class break's symbol object.

Properties

PropertyExplanationData Type
description
(Read and Write)

Gets and sets the description for the class break.

String
label
(Read and Write)

Gets and sets the label for the class break.

String
symbol
(Read and Write)

Gets and sets the symbol associated with the class break.

Symbol
upperBound
(Read and Write)

Gets and sets the maximum value for the class break.

Double

Code sample

ClassBreak example

The following script modifies the symbology of a polygon layer that uses a graduate color renderer. It sets the classificationField and breakCount and iterates through each class break and modifies the upperBound, label, description, and symbol properties such as color, outlineColor, and size. The labels for each break are formatted to include thousands separators. The fill color graduates from red to blue, and the outline color goes from blue to red and increases in size with each break.

# -*- coding: utf-8 -*-
import arcpy, os, sys, locale

relpath = os.path.dirname(sys.argv[0])

p = arcpy.mp.ArcGISProject(relpath + r"\\GraduatedColors.aprx")
m = p.listMaps("Layers")[0]
l = m.listLayers("Natural*")[0]

sym = l.symbology
sym.renderer.classificationField = "Shape_Area"
sym.renderer.breakCount = 7

breakVal = 100000000000
cv = 0
lw = 1
for brk in sym.renderer.classBreaks:
  brk.upperBound = breakVal
  brk.label = "\u2264" + str(locale.format("%d", breakVal, grouping=True))
  brk.description = "Description " + str(cv)
  brk.symbol.color = {'HSV' : [cv, 100, 100, 100]}
  brk.symbol.outlineColor = {'HSV' : [240-cv, 100, 100, 100]}
  brk.symbol.size = lw

  breakVal +=100000000000
  cv += 40
  lw += 0.5
l.symbology = sym

p.saveACopy(relpath + r'\\SavedOutput.aprx')