<?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: How to Increase the Legend Item Font Size Using Python Access CIM in ArcGIS Pro ? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-increase-the-legend-item-font-size-using/m-p/1162661#M53843</link>
    <description>&lt;P&gt;Can you provide the snippet of code you are using AND perhaps a screenshot of the legend and legenditem that is not working as expected?&amp;nbsp; I see above that you noted that you figured it out but I'm not sure if that is current.&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;</description>
    <pubDate>Fri, 08 Apr 2022 18:26:14 GMT</pubDate>
    <dc:creator>JeffBarrette</dc:creator>
    <dc:date>2022-04-08T18:26:14Z</dc:date>
    <item>
      <title>How to Increase the Legend Item Font Size Using Python Access CIM in ArcGIS Pro ?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-increase-the-legend-item-font-size-using/m-p/1056322#M40765</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello:)&lt;/P&gt;&lt;P&gt;I'm running a map automation to create over 100 species maps that share a common base map but vary with the species points showed each time. I have successfully created the maps, and exported them as PNG using arcpy, but on each map export the legend font size is really tiny (default font size 10). I want to increase the font for better visualization.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I&amp;nbsp; found that arcpy does not contain a method to modify the legend item font size, so I used CIM in the hope to access more detailed legend property settings. (the red arrow in picture 1 below is the place I want to modify through CIM).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's what I tried:&lt;/P&gt;&lt;P&gt;I exported one of the species map, &lt;EM&gt;Arthrosporum populorum&lt;/EM&gt;,&amp;nbsp; as a PAGX file and I viewed it as a JSON file in a text editor. Picture 2 shows that starting from &lt;EM&gt;line 4643&amp;nbsp;&lt;/EM&gt;is the place I'm interested in ("&lt;EM&gt;Arthrosporum populorum_layer&amp;nbsp;&lt;/EM&gt;is a point feature layer"). However, I didn't see anything such as a "fontSize" key that allows me to modify. Have I searched for the wrong object place, or are there any other places I should be looking for as well?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really appreciate your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 18:02:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-increase-the-legend-item-font-size-using/m-p/1056322#M40765</guid>
      <dc:creator>MingCao</dc:creator>
      <dc:date>2021-05-10T18:02:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to Increase the Legend Item Font Size Using Python Access CIM in ArcGIS Pro ?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-increase-the-legend-item-font-size-using/m-p/1056325#M40766</link>
      <description>&lt;P&gt;sorry I didn't make the pictures readily visible, here are the ones I mentioned above:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pic 1.jpg" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/12971iC8F9C91C6F53A428/image-size/medium?v=v2&amp;amp;px=400" role="button" title="pic 1.jpg" alt="pic 1.jpg" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;pic 1.jpg&lt;/span&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="pic 2.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/12972i80E0415A6C942849/image-size/large?v=v2&amp;amp;px=999" role="button" title="pic 2.png" alt="pic 2.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;pic 2.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 18:08:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-increase-the-legend-item-font-size-using/m-p/1056325#M40766</guid>
      <dc:creator>MingCao</dc:creator>
      <dc:date>2021-05-10T18:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to Increase the Legend Item Font Size Using Python Access CIM in ArcGIS Pro ?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-increase-the-legend-item-font-size-using/m-p/1056438#M40779</link>
      <description>&lt;P&gt;I just figured out myself, but thank you for checking!&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

# access the current map project, and the newly added layout(called x)
aprx = arcpy.mp.ArcGISProject("CURRENT")
x = aprx.listLayouts()[-1]
x.name

# access the CIM of this layout
x_cim = x.getDefinition('V2')

# change the legend font size to 26
for itm in x_cim.elements:
    if itm.name == "Legend":
        for species in itm.items:
            species.labelSymbol.symbol.height = 26

# save the CIM edits 
x.setDefinition(x_cim)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 21:05:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-increase-the-legend-item-font-size-using/m-p/1056438#M40779</guid>
      <dc:creator>MingCao</dc:creator>
      <dc:date>2021-05-10T21:05:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to Increase the Legend Item Font Size Using Python Access CIM in ArcGIS Pro ?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-increase-the-legend-item-font-size-using/m-p/1056439#M40780</link>
      <description>&lt;P&gt;Hello MingCao,&lt;/P&gt;&lt;P&gt;Below is a snippet of code that modifies a layer's legend item label size using Python CIM access.&amp;nbsp; Note - you may not get the results you expect if your Legend is using a fitting strategy that involves automatically adjusting font size.&amp;nbsp; Also be careful about setting LayerNames vs Labels font size.&amp;nbsp; It depends on the properties of the legend which ones are displayed.&lt;/P&gt;&lt;P&gt;Uncomment the last two lines if you want to change the font size.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;p = arcpy.mp.ArcGISProject('current')
lyt = p.listLayouts('Layout_MS')[0]
lyt_cim = lyt.getDefinition('V2')
for elm in lyt_cim.elements:
  if elm.name == "Legend":
    print(elm.fittingStrategy)
    for itm in reversed(elm.items):
      if itm.name == "GreatLakes":
        print(itm.labelSymbol.symbol.height)
        #itm.labelSymbol.symbol.height = 9.99
#lyt.setDefinition(lyt_cim)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 21:05:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-increase-the-legend-item-font-size-using/m-p/1056439#M40780</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2021-05-10T21:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to Increase the Legend Item Font Size Using Python Access CIM in ArcGIS Pro ?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-increase-the-legend-item-font-size-using/m-p/1056441#M40781</link>
      <description>&lt;P&gt;Ha, you beat me by 7 seconds.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jeff&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 21:07:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-increase-the-legend-item-font-size-using/m-p/1056441#M40781</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2021-05-10T21:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to Increase the Legend Item Font Size Using Python Access CIM in ArcGIS Pro ?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-increase-the-legend-item-font-size-using/m-p/1056442#M40782</link>
      <description>&lt;P&gt;Ohh thank you so much sir! I just saw your post &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Have a lovely week:)&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 21:08:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-increase-the-legend-item-font-size-using/m-p/1056442#M40782</guid>
      <dc:creator>MingCao</dc:creator>
      <dc:date>2021-05-10T21:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to Increase the Legend Item Font Size Using Python Access CIM in ArcGIS Pro ?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-increase-the-legend-item-font-size-using/m-p/1162346#M53806</link>
      <description>&lt;P&gt;I'm still getting an error saying&amp;nbsp;'MappingLegendItemObject' object has no attribute 'labelSymbol'.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 22:34:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-increase-the-legend-item-font-size-using/m-p/1162346#M53806</guid>
      <dc:creator>MitchellBlacquiere</dc:creator>
      <dc:date>2022-04-07T22:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to Increase the Legend Item Font Size Using Python Access CIM in ArcGIS Pro ?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-increase-the-legend-item-font-size-using/m-p/1162661#M53843</link>
      <description>&lt;P&gt;Can you provide the snippet of code you are using AND perhaps a screenshot of the legend and legenditem that is not working as expected?&amp;nbsp; I see above that you noted that you figured it out but I'm not sure if that is current.&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 18:26:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-increase-the-legend-item-font-size-using/m-p/1162661#M53843</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2022-04-08T18:26:14Z</dc:date>
    </item>
  </channel>
</rss>

