Using ArcGIS Desktop, is there a way for the legend, to only show the subitems that are displayed on the map?
The Legend Limiter only works on layers that use "unique value categories" to define symbology. This style of legend can be set up in the Symbology tab of the Layer Properties dialog. Legend Limiter will not limit the symbology of layers set up with single symbol symbology.
There is no need to write any additional ArcPy for this. Simply use dynamic legends (which were added at ArcGIS 10.1) when you are authoring your maps.
The Map Extent Options allow you to control how eligible legend items interact with the current map extent. If the Only show classes that are visible in the current map extent check box is checked, a legend item class will only appear in the legend if a feature from that class is in the current extent. If no features from that legend item are in the current extent, the entire item will be removed from the legend.
i think this code will help:
import arcpy import arcpy.mapping import os import sys from arcpy import env import string env.workspace = r"C:\Project" for mxdname in arcpy.ListFiles("*.mxd"): print mxdname mxd = arcpy.mapping.MapDocument(r"C:\Project\\" + mxdname) legend = arcpy.mapping.ListLayoutElements(mxd,"LEGEND_ELEMENT") for lyr in legend.listLegendItemLayers(): legend.updateItem(lyr, use_visible_extent = True) print 'updateItem' mxd.save() del mxd