I'm using ArcMap 10.3. In symbology, there are 6 decimal digits for the different classes of the variable I'm presenting. I'd like to show only 3 decimal digits. I can edit the label and change the decimals manually for each class. Is there any faster way to do this for all classes in ArcMap 10.3?
You can accomplish this with the arcpy.mapping
module. The following should work as long as your symbology is GraduatedColorsSymbology
. Just paste into the python window and run the function with your layer name and number of decimal places. Since it's using Python's built-in round()
function, you can even use negative numbers.
def trunclabels(lyrname, n):
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
lyr = arcpy.mapping.ListLayers(mxd, lyrname, df)[0]
labels = lyr.symbology.classBreakLabels
#split the labels, cast to float, round, then join back together
lyr.symbology.classBreakLabels = ["{} - {}".format(*r)
for r in [[round(float(f), n)
for f in lab.split(" - ")]
for lab in labels]]
arcpy.RefreshTOC()
del mxd, df
-
do you know how to do this in ArcGIS Pro? When I try and use
trunclabels
I get the following error:AttributeError: module 'arcpy.mp' has no attribute 'ListDataFrames'
– Matt A. Dec 15 '17 at 16:44 -
.bat
file based off this blog (it's just a few calls toffmpeg
). Drag a video file onto it and choose start and/or ending times. You can use any recording software, but I'm using Snagit. – Paul Nov 5 '15 at 17:48