<?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 Re: Graduated Colors Renderer On Existing Layer Not Successful in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/graduated-colors-renderer-on-existing-layer-not/m-p/1095171#M62241</link>
    <description>&lt;P&gt;but sadly you didn't get an error message for little "current".&lt;/P&gt;&lt;P&gt;Now that you mention it, I have found your "&lt;SPAN&gt;Graduated Colors --&amp;gt; Unique Values --&amp;gt; back to Graduated Colors" my experience when working manually with classifications... It is almost instinctive now that you mention it.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 02 Sep 2021 23:08:05 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2021-09-02T23:08:05Z</dc:date>
    <item>
      <title>Graduated Colors Renderer On Existing Layer Not Successful</title>
      <link>https://community.esri.com/t5/python-questions/graduated-colors-renderer-on-existing-layer-not/m-p/1094993#M62235</link>
      <description>&lt;P&gt;Using the below script, I'm not able to change a layers symbology if it is already set. For example, I have three layers with 4 break values and labels each. The intention of the script is to change a break value and label. If I run the script on the layers as they exist currently, the script runs successfully, but the changes aren't made and I get an error of sorts in the Symbology pane.&lt;/P&gt;&lt;P&gt;Three graduated colors layers before running script.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JaredPilbeam2_1-1630601120191.png" style="width: 295px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/22301i0275055776842DF2/image-dimensions/295x463?v=v2" width="295" height="463" role="button" title="JaredPilbeam2_1-1630601120191.png" alt="JaredPilbeam2_1-1630601120191.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I change a break value from 55.3 to 56.3, and it's corresponding label. Then I run the script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy, os, sys
# Reference a project, map, and layer using arcpy.mp
p = arcpy.mp.ArcGISProject('current')
m = p.listMaps()[0]
lyr = m.listLayers()

for l in lyr[1:4]:
    sym = l.symbology
    if hasattr(sym, 'renderer'):
        if sym.renderer.type == 'GraduatedColorsRenderer':
            sym.renderer.classificationField = 'VaccPercentageTotPop'
            print(f'changing layer symbology for {l}')
            
            #enter class break values
            classBreakValues = [40, 45, 56.3, 100]
            classBreakLabels = ["0% - 40%", "40.01% - 45%", "45.01% - 56.3%", "55.31% - 100%"]
            
            # Run the renderer.breakCount function to use the classBreakValues array parameters as the values, and create a counter.
            sym.renderer.breakCount = len(classBreakValues)
            count = 0
            
            #Create a loop to set the renderer
        for brk in sym.renderer.classBreaks:
            brk.upperBound = classBreakValues[count]
            brk.label = classBreakLabels[count]
            count +=1
        
        l.symbology = sym
p.save()

###prints:
### changing layer symbology for Elementary Districts
### changing layer symbology for Secondary Districts
### changing layer symbology for Unified Districts&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following is what happens. I get a warning in the Symbology pane (which doesn't tell me much).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JaredPilbeam2_2-1630601749387.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/22304iE0034FA0C2F273FE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JaredPilbeam2_2-1630601749387.png" alt="JaredPilbeam2_2-1630601749387.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And my layers no longer have values.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JaredPilbeam2_3-1630601772187.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/22305i2556B4C0E78581D6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JaredPilbeam2_3-1630601772187.png" alt="JaredPilbeam2_3-1630601772187.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 16:59:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/graduated-colors-renderer-on-existing-layer-not/m-p/1094993#M62235</guid>
      <dc:creator>JaredPilbeam2</dc:creator>
      <dc:date>2021-09-02T16:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: Graduated Colors Renderer On Existing Layer Not Successful</title>
      <link>https://community.esri.com/t5/python-questions/graduated-colors-renderer-on-existing-layer-not/m-p/1095089#M62238</link>
      <description>&lt;P&gt;I don't suppose&amp;nbsp;&lt;SPAN&gt;"CURRENT" would be the cause given that this is python and assuming esri would be following pythonic adherence to case sensitivity etc ....&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 20:00:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/graduated-colors-renderer-on-existing-layer-not/m-p/1095089#M62238</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-09-02T20:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: Graduated Colors Renderer On Existing Layer Not Successful</title>
      <link>https://community.esri.com/t5/python-questions/graduated-colors-renderer-on-existing-layer-not/m-p/1095107#M62239</link>
      <description>&lt;P&gt;"CURRENT" and "current" seem to be interchangeable I've found.&lt;/P&gt;&lt;P&gt;However, if I reset the layers' symbology, and then run the script it works fine. But, I won't be resetting the symbology every time just so I can run the script, of course. By "reset" I mean physically changing the symbology: Graduated Colors --&amp;gt; Unique Values --&amp;gt; back to Graduated Colors.&lt;/P&gt;&lt;P&gt;For some reason,&amp;nbsp; it doesn't like that the symbology is already set as Graduated Colors.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 20:18:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/graduated-colors-renderer-on-existing-layer-not/m-p/1095107#M62239</guid>
      <dc:creator>JaredPilbeam2</dc:creator>
      <dc:date>2021-09-02T20:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: Graduated Colors Renderer On Existing Layer Not Successful</title>
      <link>https://community.esri.com/t5/python-questions/graduated-colors-renderer-on-existing-layer-not/m-p/1095113#M62240</link>
      <description>&lt;P&gt;I've also tried the script as a standalone. No cigar.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 20:37:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/graduated-colors-renderer-on-existing-layer-not/m-p/1095113#M62240</guid>
      <dc:creator>JaredPilbeam2</dc:creator>
      <dc:date>2021-09-02T20:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: Graduated Colors Renderer On Existing Layer Not Successful</title>
      <link>https://community.esri.com/t5/python-questions/graduated-colors-renderer-on-existing-layer-not/m-p/1095171#M62241</link>
      <description>&lt;P&gt;but sadly you didn't get an error message for little "current".&lt;/P&gt;&lt;P&gt;Now that you mention it, I have found your "&lt;SPAN&gt;Graduated Colors --&amp;gt; Unique Values --&amp;gt; back to Graduated Colors" my experience when working manually with classifications... It is almost instinctive now that you mention it.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 23:08:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/graduated-colors-renderer-on-existing-layer-not/m-p/1095171#M62241</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-09-02T23:08:05Z</dc:date>
    </item>
  </channel>
</rss>

