0

I have a series of (many) layers in an ArcGIS 10.1 map that are all symbolized using graduated colors. Each layer has the same number of breaks; however, the break values are different for each layer.

For the map legend, I have to prefix the labels for each of the layers so that it looks something like this:
0 - 50%: (break values)
50 - 75%: (break values)
75 - 90%: (break values)
etc...

I'm trying to find a programmatic way of inserting the prefixes into the labels. I know that arcpy gives read/write access to the labels via the classBreakLabels property.

I'm a Python newbie (but learning) so I'm wondering if it's even possible to read the current labels, load them into a list (or an array?), then add the prefix values (which are static and don't change).

Any suggestions?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Oct 17, 2013 at 15:24
1
  • Would you be able to include pictures of your Symbology tab and how you want your corresponding legend to look? Also, is there a Python snippet of what you are trying that you can include too? Commented Oct 17, 2013 at 20:20

1 Answer 1

2

I think I have it figured out - it was much simpler than I imagined. Not pretty, but here's the relevant code to update legend labels:

x = lyr.symbology.classBreakLabels
a = "0 - 50%: " + x[0]
b = "50 - 75%: " + x[1]
c = "75 - 90%: " + x[2]
d = "90 - 95%: " + x[3]
e = "95 - 98%: " + x[4]
f = "98 - 100%: " + x[5]
lyr.symbology.classBreakLabels = [a,b,c,d,e,f]

The output looks something like this in the legend:
0 - 50%: 0 - 10
50 - 75%: 11 - 20
75 - 90%: 21 - 30
etc...

It exports to PDF correctly, which is exactly what I need!

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
answered Oct 18, 2013 at 15:27

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.