Arcpy: legend.addItem

08-01-2019 10:09 AM
Status: Implemented
Labels (1)
New Contributor II

I have been trying to find a solution to a problem I have been having for several days now.  I am trying to insert a layer that is in my TOC as an item into my legend.  According to the LegendElement documentation, you can use legend.removeItem to remove a specific item from your layer.  From all of my research and tests, there is not an opposite of removeItem, in my case, addItem.  Having the ability to do legend.addItem to insert an item from the TOC into the legend would extremely useful.  It would also make it even better if we could index where in the legend the new item went.  If legend.removeItem is possible, then surely legend.addItem is possible as well?

by Anonymous User

This was added into ArcGISPro 2.7.  The Legend class has 3 new methonds: addItem, moveItem and removeItem.

Jeff - team

Status changed to: Implemented

Implemented in ArcGIS Pro 2.7.

See Ideas in ArcGIS Pro 2.7: Something to Celebrate 

Also check out what's new in ArcGIS Pro 2.7!