Guest User

Untitled

a guest
Dec 16th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. import arcpy
  2.  
  3. workspace = r'C:gdb_dir'
  4. workspaces = arcpy.ListFiles('*.gdb') # list of files to process
  5.  
  6. for workspace in workspaces:
  7. name_prefix = workspace[0:-4]
  8. current_MXD = name_prefix + '.mxd' # this file will already exist
  9.  
  10. dataSrc = r'C:name_prefixSample.gdbDetailFeatures'
  11. fieldX = 'NEAR_X'
  12. fieldY = 'NEAR_Y'
  13. graph_template = r'C:tempScatterGraphTemplate.tee'
  14. out_graph_name = "ScatterTest"
  15. out_graph = r'c:graphs' + name_prefix + '.grf' # How to insert this into mxd?
  16.  
  17. graph = arcpy.Graph()
  18.  
  19. graph.addSeriesScatterPlot(dataSrc, fieldY, fieldX)
  20. graph.graphAxis[0].title = "Near Y"
  21. graph.graphAxis[2].title = "Near X"
  22. graph.graphPropsGeneral.title = "Test of Flake Property Graph"
  23. arcpy.MakeGraph_management(graph_template, graph, out_graph_name)
  24.  
  25. arcpy.SaveGraph_management(out_graph_name, out_graph, "MAINTAIN_ASPECT_RATIO", 600, 375)
  26.  
  27. import arcpy
  28. mxd = arcpy.mapping.MapDocument(r"C:ProjectProject.mxd")
  29. for elm in arcpy.mapping.ListLayoutElements(mxd, "PICTURE_ELEMENT"):
  30. if elm.name == "GRAPH":
  31. elm.sourceImage = r"C:ProjectDataMyGraph.jpg"
  32. mxd.save()
  33. del mxd
Add Comment
Please, Sign In to add comment