<?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: Format Legend with Arcpy in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/format-legend-with-arcpy/m-p/1051942#M40312</link>
    <description>&lt;P&gt;Your code is missing&lt;/P&gt;</description>
    <pubDate>Tue, 27 Apr 2021 20:10:48 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2021-04-27T20:10:48Z</dc:date>
    <item>
      <title>Format Legend with Arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/format-legend-with-arcpy/m-p/1051932#M40309</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to set a specific format from the legend. Ideally, I would like to assign a Font Size and Font Colour for both Group Layer Name and the Layer Label within it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, even though I set the below parameters with my preference in the Desktop, as soon as I add/refresh the layer within this legend, the Font Colour and Size is again as default being black.&lt;/P&gt;&lt;P&gt;Could you please let me know how to fix this or if there is a way to amend this dynamically using arcpy?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;UDPATE: I've just found that I need to set this as Default within the legend item by right clicking over it. I've not find a way to do this with arcpy; so please feel free to share it here even though I found a workaround &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="anamanvil_0-1619552620403.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/11984i1AD9D284063EBB6D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="anamanvil_0-1619552620403.png" alt="anamanvil_0-1619552620403.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 20:29:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/format-legend-with-arcpy/m-p/1051932#M40309</guid>
      <dc:creator>anamanvil</dc:creator>
      <dc:date>2021-04-27T20:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: Format Legend with Arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/format-legend-with-arcpy/m-p/1051942#M40312</link>
      <description>&lt;P&gt;Your code is missing&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 20:10:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/format-legend-with-arcpy/m-p/1051942#M40312</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-04-27T20:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: Format Legend with Arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/format-legend-with-arcpy/m-p/1051949#M40313</link>
      <description>&lt;P&gt;Just updated the post. Unfortunately I have not been able to find out how to access this through arcpy, so no code is shared. I've just tried it manually.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 20:26:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/format-legend-with-arcpy/m-p/1051949#M40313</guid>
      <dc:creator>anamanvil</dc:creator>
      <dc:date>2021-04-27T20:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: Format Legend with Arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/format-legend-with-arcpy/m-p/1051964#M40315</link>
      <description>&lt;P&gt;Anamanvil,&lt;/P&gt;&lt;P&gt;I can provide a sample Python script using Python CIM access but 1) I really want to know more about the UI and why it is automatically readjusting.&amp;nbsp; What is your fitting strategy?&amp;nbsp; If you have auto adjust font size, I would expect font size to ignore your settings because the legend was set to auto adjust.&amp;nbsp; 2) Python CIM access is slightly more advanced.&amp;nbsp; Are you familiar with arcpy.mp?&amp;nbsp; Again, I'm a happy to send a snippet but I want to make sure there is not a bug in the application.&lt;/P&gt;&lt;P&gt;Jeff - arcpy.mp and Layout teams&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 20:44:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/format-legend-with-arcpy/m-p/1051964#M40315</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2021-04-27T20:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: Format Legend with Arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/format-legend-with-arcpy/m-p/1051994#M40319</link>
      <description>&lt;P&gt;Here is a snippet that changes the group layer name size and color. For more information on Python CIM access:&amp;nbsp;&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/python-cim-access.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/python-cim-access.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;lyt.setDefinition(lyt_cim)
arcpy.mp.ArcGISProject('current')
lyt = p.listLayouts('Layout_MS')[0]
lyt_cim = lyt.getDefinition('V2')
for e in lyt_cim.elements:
  if e.name == 'Legend':
    for itm in e.items:
      if itm.name == 'GreatLakes':
          itm.groupLayerNameSymbol.symbol.height = 24  #Change font size
          itm.groupLayerNameSymbol.symbol.symbol.symbolLayers[0].color.values = [255,255,20, 100] #change RGB color
lyt.setDefinition(lyt_cim)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Jeff - arcpy.mp and Layout teams&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 21:45:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/format-legend-with-arcpy/m-p/1051994#M40319</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2021-04-27T21:45:01Z</dc:date>
    </item>
  </channel>
</rss>

