import arcpy # Set Local Variables profileLine = "C:/temp/data.gdb/profile" profileTargets = "C:/temp/data.gdb/raster" profileTable = "C:/temp/value.dbf" graphName = "Sample Graph" outGraph = "C:/temp/graph.png" # Execute StackProfile arcpy.StackProfile_3d(profileLine, profileTargets, profileTable, graphName) # # Execute SaveGraph arcpy.SaveGraph_management(graphName, outGraph, "MAINTAIN_ASPECT_RATIO")
Solved! Go to Solution.
import arcpy # Set Local Variables homedir = "C:/mpo/opgaver/grafer/data.gdb/" home = "C:/mpo/opgaver/grafer/" profileLine = homedir+"profile" profileTargets = homedir+"raster" profileTable = homedir+"value" out_graph_name = "VerticalBarGraph6" out_graph_pic = home+"graph.png" # Graph template to use, # 1) Create graph in ArcGIS: View-> Graphs-> Create Graph-> Next-> Finish # 2) Then save as template file: Rigth click graph from 1)-> Export-> Native-> Text-> Save # 3) Rename .txt file to .tee input_template = home+"line2.tee" # Execute StackProfile arcpy.StackProfile_3d(profileLine, profileTargets, profileTable) # Create the graph graph = arcpy.Graph() # Add a vertical line series to the graph graph.addSeriesLineVertical (profileTable, "FIRST_Z", "FIRST_DIST", "" , "") # Output a graph, which is created in-memory arcpy.MakeGraph_management(input_template, graph, out_graph_name) # Save the graph as an image arcpy.SaveGraph_management(out_graph_name, out_graph_pic,"IGNORE_ASPECT_RATIO", 900, 200)
import arcpy # Set Local Variables homedir = "C:/mpo/opgaver/grafer/data.gdb/" home = "C:/mpo/opgaver/grafer/" profileLine = homedir+"profile" profileTargets = homedir+"raster" profileTable = homedir+"value" out_graph_name = "VerticalBarGraph6" out_graph_pic = home+"graph.png" # Graph template to use, # 1) Create graph in ArcGIS: View-> Graphs-> Create Graph-> Next-> Finish # 2) Then save as template file: Rigth click graph from 1)-> Export-> Native-> Text-> Save # 3) Rename .txt file to .tee input_template = home+"line2.tee" # Execute StackProfile arcpy.StackProfile_3d(profileLine, profileTargets, profileTable) # Create the graph graph = arcpy.Graph() # Add a vertical line series to the graph graph.addSeriesLineVertical (profileTable, "FIRST_Z", "FIRST_DIST", "" , "") # Output a graph, which is created in-memory arcpy.MakeGraph_management(input_template, graph, out_graph_name) # Save the graph as an image arcpy.SaveGraph_management(out_graph_name, out_graph_pic,"IGNORE_ASPECT_RATIO", 900, 200)