Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import arcpy
- workspace = r'C:gdb_dir'
- workspaces = arcpy.ListFiles('*.gdb') # list of files to process
- for workspace in workspaces:
- name_prefix = workspace[0:-4]
- current_MXD = name_prefix + '.mxd' # this file will already exist
- dataSrc = r'C:name_prefixSample.gdbDetailFeatures'
- fieldX = 'NEAR_X'
- fieldY = 'NEAR_Y'
- graph_template = r'C:tempScatterGraphTemplate.tee'
- out_graph_name = "ScatterTest"
- out_graph = r'c:graphs' + name_prefix + '.grf' # How to insert this into mxd?
- graph = arcpy.Graph()
- graph.addSeriesScatterPlot(dataSrc, fieldY, fieldX)
- graph.graphAxis[0].title = "Near Y"
- graph.graphAxis[2].title = "Near X"
- graph.graphPropsGeneral.title = "Test of Flake Property Graph"
- arcpy.MakeGraph_management(graph_template, graph, out_graph_name)
- arcpy.SaveGraph_management(out_graph_name, out_graph, "MAINTAIN_ASPECT_RATIO", 600, 375)
- import arcpy
- mxd = arcpy.mapping.MapDocument(r"C:ProjectProject.mxd")
- for elm in arcpy.mapping.ListLayoutElements(mxd, "PICTURE_ELEMENT"):
- if elm.name == "GRAPH":
- elm.sourceImage = r"C:ProjectDataMyGraph.jpg"
- mxd.save()
- del mxd
Add Comment
Please, Sign In to add comment