I have created an interpolated map with arcpy.IDW_ga and I am exporting it to PDF with arcpy.mapping.ExportToPDF. How can I add a legend to the map with ArcPy? In the end, I want to apply the code to create 100 maps, so manually is not a solution. I know I can just go to Insert>> Legend, but I need an automated solution.
arcpy.IDW_ga(in_features = in_features,
z_field= z_field, out_ga_layer="",
out_raster="Interpolation/year/" + name_save,
cell_size="6.46298456489016E-03",
power="2",
search_neighborhood="NBRTYPE=Standard S_MAJOR=0.336780807796406 S_MINOR=0.336780807796406 ANGLE=0 NBR_MAX=15 NBR_MIN=10 SECTOR_TYPE=ONE_SECTOR",
weight_field="")
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
arcpy.mapping.ExportToPDF(mxd, "C:/Users/"mypdf.pdf")