<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Format numbers in legend labels (Symbology classBreaks) in Python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/format-numbers-in-legend-labels-symbology/m-p/1263815#M66982</link>
    <description>&lt;P&gt;Hello All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;In ArcGISPro&amp;nbsp;in the &lt;STRONG&gt;Symbology&lt;/STRONG&gt; pane under&lt;STRONG&gt; Advanced symbology options&lt;/STRONG&gt;, there is a section that you can &lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/mapping/layer-properties/format-numbers-in-legend-labels.htm" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;"Format numbers in legend labels"&lt;/STRONG&gt;,&lt;/A&gt;&amp;nbsp;and I was looking for &lt;STRONG&gt;Python equivalent&lt;/STRONG&gt; of that to reduce decimal points and set number format to percentage etc.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can access the labels and write some functions to handle them manually, but &lt;U&gt;I was wondering if there is a Python method (maybe in CIM?) that can access the engine that gives this capability to ArcGISPro?&amp;nbsp;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;Right now I would access labels like this: (Just part of the hypothetical script)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;sym = lyr.symbology
cl_breaks= sym.renderer.classBreaks # list of break cutoff objects
# list of actual labels
labels_ls = [cl_breaks[i].label for i in range(len(cl_breaks))]
# the function that -hopefully I don't have to write- to get the labels and split and reformat them! 
formatted_labels = my_label_handler(labels_ls) 
for c, brk in enumerate(cl_breaks):
    brk.label = formatted_labels[c]
lyr.symbology = sym&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 02 Mar 2023 23:18:12 GMT</pubDate>
    <dc:creator>Mahdi_Ch</dc:creator>
    <dc:date>2023-03-02T23:18:12Z</dc:date>
    <item>
      <title>Format numbers in legend labels (Symbology classBreaks) in Python</title>
      <link>https://community.esri.com/t5/python-questions/format-numbers-in-legend-labels-symbology/m-p/1263815#M66982</link>
      <description>&lt;P&gt;Hello All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;In ArcGISPro&amp;nbsp;in the &lt;STRONG&gt;Symbology&lt;/STRONG&gt; pane under&lt;STRONG&gt; Advanced symbology options&lt;/STRONG&gt;, there is a section that you can &lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/mapping/layer-properties/format-numbers-in-legend-labels.htm" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;"Format numbers in legend labels"&lt;/STRONG&gt;,&lt;/A&gt;&amp;nbsp;and I was looking for &lt;STRONG&gt;Python equivalent&lt;/STRONG&gt; of that to reduce decimal points and set number format to percentage etc.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can access the labels and write some functions to handle them manually, but &lt;U&gt;I was wondering if there is a Python method (maybe in CIM?) that can access the engine that gives this capability to ArcGISPro?&amp;nbsp;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;Right now I would access labels like this: (Just part of the hypothetical script)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;sym = lyr.symbology
cl_breaks= sym.renderer.classBreaks # list of break cutoff objects
# list of actual labels
labels_ls = [cl_breaks[i].label for i in range(len(cl_breaks))]
# the function that -hopefully I don't have to write- to get the labels and split and reformat them! 
formatted_labels = my_label_handler(labels_ls) 
for c, brk in enumerate(cl_breaks):
    brk.label = formatted_labels[c]
lyr.symbology = sym&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 23:18:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/format-numbers-in-legend-labels-symbology/m-p/1263815#M66982</guid>
      <dc:creator>Mahdi_Ch</dc:creator>
      <dc:date>2023-03-02T23:18:12Z</dc:date>
    </item>
  </channel>
</rss>

