<?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: Change symbology of a layer using arcpy in ArcPro in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/change-symbology-of-a-layer-using-arcpy-in-arcpro/m-p/612912#M47813</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, "value"&amp;nbsp;is the name of a&amp;nbsp;column/field in the layer "polygons". After running the script, if I print the layer's symbology, e.g.:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;print(lyr.renderer)
print(lyr.classificationMethod)‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The printed symbology properties appear to have updated. However, the change will not be reflected in the layer in the map view, and if I right click the layer in the TOC and go to symbology, it has all the old properties. I'm wondering if it's a bug.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 02:12:55 GMT</pubDate>
    <dc:creator>JessicaDecuir</dc:creator>
    <dc:date>2021-12-12T02:12:55Z</dc:date>
    <item>
      <title>Change symbology of a layer using arcpy in ArcPro</title>
      <link>https://community.esri.com/t5/python-questions/change-symbology-of-a-layer-using-arcpy-in-arcpro/m-p/612908#M47809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;I'm using ArcPro version 2.5.2. I want to change the symbology of a layer in my map using python. I'm developing and executing the code out of an ArcGIS Notebook. The layer was added to the map from a feature class geodatabase. I've followed the code examples in the ESRI documentation, but cannot produce results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; The code I've written will run without an error, but the updated symbology won't change/show in the map view. For example, if I "print" details of the layer's symbology after running my script, it will appear that it has been updated. However, the layer in the map view looks the same, and right clicking symbology on the layer shows the old parameters. This problem is not limited to a particular layer, but all the layers in my projects. Where am I going wrong? Any is help appreciated. Below is the generic code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

&lt;SPAN class="comment token"&gt;# define project&lt;/SPAN&gt;
project_path &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Users\person\Desktop\folder\project.aprx"&lt;/SPAN&gt;
p &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;project_path&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# specify map in project named "Map"&lt;/SPAN&gt;
m &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; p&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listMaps&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Map'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# specify layer in map named "polygons"&lt;/SPAN&gt;
lyr &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; m&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listLayers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'polygons'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# access symbology of layer and change symbology to graduated colors&lt;/SPAN&gt;
sym &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;symbology
sym&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;updateRenderer&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'GraduatedColorsRenderer'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
sym&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;renderer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;classificationField &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'value'&lt;/SPAN&gt;
sym&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;classificationMethod &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'NaturalBreaks'&lt;/SPAN&gt;
sym&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;renderer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;breakCount &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;10&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# save symbology back onto layer&lt;/SPAN&gt;
lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;symbology &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; sym

&lt;SPAN class="comment token"&gt;# save project&lt;/SPAN&gt;
p&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;save&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:12:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-symbology-of-a-layer-using-arcpy-in-arcpro/m-p/612908#M47809</guid>
      <dc:creator>JessicaDecuir</dc:creator>
      <dc:date>2021-12-12T02:12:53Z</dc:date>
    </item>
    <item>
      <title>Re: Change symbology of a layer using arcpy in ArcPro</title>
      <link>https://community.esri.com/t5/python-questions/change-symbology-of-a-layer-using-arcpy-in-arcpro/m-p/612909#M47810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't see where 'm' in line 11 has been defined. For line 8, try this:&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;m = p.listMaps('Map')[0]&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Nov 2020 01:53:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-symbology-of-a-layer-using-arcpy-in-arcpro/m-p/612909#M47810</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2020-11-06T01:53:04Z</dc:date>
    </item>
    <item>
      <title>Re: Change symbology of a layer using arcpy in ArcPro</title>
      <link>https://community.esri.com/t5/python-questions/change-symbology-of-a-layer-using-arcpy-in-arcpro/m-p/612910#M47811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oops, good catch. I accidentally left that out in the "pseudo code" I originally posted. The code I'm running has the "m" defined, but it's still not working. I edited the original post to define the "m".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Nov 2020 04:44:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-symbology-of-a-layer-using-arcpy-in-arcpro/m-p/612910#M47811</guid>
      <dc:creator>JessicaDecuir</dc:creator>
      <dc:date>2020-11-06T04:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: Change symbology of a layer using arcpy in ArcPro</title>
      <link>https://community.esri.com/t5/python-questions/change-symbology-of-a-layer-using-arcpy-in-arcpro/m-p/612911#M47812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And checking line 16, 'value' is a valid field name found in the layer named 'polygons'?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Nov 2020 05:25:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-symbology-of-a-layer-using-arcpy-in-arcpro/m-p/612911#M47812</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2020-11-06T05:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Change symbology of a layer using arcpy in ArcPro</title>
      <link>https://community.esri.com/t5/python-questions/change-symbology-of-a-layer-using-arcpy-in-arcpro/m-p/612912#M47813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, "value"&amp;nbsp;is the name of a&amp;nbsp;column/field in the layer "polygons". After running the script, if I print the layer's symbology, e.g.:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;print(lyr.renderer)
print(lyr.classificationMethod)‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The printed symbology properties appear to have updated. However, the change will not be reflected in the layer in the map view, and if I right click the layer in the TOC and go to symbology, it has all the old properties. I'm wondering if it's a bug.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:12:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-symbology-of-a-layer-using-arcpy-in-arcpro/m-p/612912#M47813</guid>
      <dc:creator>JessicaDecuir</dc:creator>
      <dc:date>2021-12-12T02:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: Change symbology of a layer using arcpy in ArcPro</title>
      <link>https://community.esri.com/t5/python-questions/change-symbology-of-a-layer-using-arcpy-in-arcpro/m-p/612913#M47814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did some testing with an older version (2.1.2) and ran your script in the Python window.&amp;nbsp; When I used a path to the open project (line 4 in the code), the changes did not appear in the open version.&amp;nbsp; I closed the project without saving and reopened it.&amp;nbsp; The changes were there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I reset the symbology and commented out line 4.&amp;nbsp; I changed line 5 to:&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;p &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"CURRENT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The remainder of the script was the same. After running the script in the Python window, the symbology in the project was updated to the new settings.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a final test, I reset the project symbology, closed Pro and ran the script outside Pro using the path to the project.&amp;nbsp; When the project was reopened, the changes were visible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, if you are working in Pro's Python window, use "CURRENT" otherwise use the path.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Nov 2020 23:52:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-symbology-of-a-layer-using-arcpy-in-arcpro/m-p/612913#M47814</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2020-11-06T23:52:57Z</dc:date>
    </item>
    <item>
      <title>Re: Change symbology of a layer using arcpy in ArcPro</title>
      <link>https://community.esri.com/t5/python-questions/change-symbology-of-a-layer-using-arcpy-in-arcpro/m-p/612914#M47815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This worked! Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Nov 2020 02:41:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-symbology-of-a-layer-using-arcpy-in-arcpro/m-p/612914#M47815</guid>
      <dc:creator>JessicaDecuir</dc:creator>
      <dc:date>2020-11-09T02:41:05Z</dc:date>
    </item>
  </channel>
</rss>

