Select to view content in your preferred language

Empty graph output from StackProfile_3d->SaveGraph_management

2757
1
Jump to solution
03-30-2014 04:03 AM
MathiasKP
Deactivated User
In a python script I'm trying to save a graph to a .png file with graph output from arcpy.StackProfile_3d but the .png file shows an empty graph. The table created from arcpy.StackProfile_3d shows values. Does anybody know why the graph is still empty?

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")


[ATTACH=CONFIG]32624[/ATTACH]
Tags (1)
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable
Original User: mathiaskopo

From http://gis.stackexchange.com/questions/91377/why-is-arcpy-stackprofile-3d-arcpy-savegraph-management... I learned that this is a bug in 10.1 http://support.esri.com/en/bugs/nimbus/TklNMDkyMzc3

Instead of using the graph output from StackProfile_3d it is possible to create a graph from the value table.

With this approach it is also possible to customize the look of the graph using a graph text template which first must be created, see intructions in the code below.

    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)

View solution in original post

0 Kudos
1 Reply
by Anonymous User
Not applicable
Original User: mathiaskopo

From http://gis.stackexchange.com/questions/91377/why-is-arcpy-stackprofile-3d-arcpy-savegraph-management... I learned that this is a bug in 10.1 http://support.esri.com/en/bugs/nimbus/TklNMDkyMzc3

Instead of using the graph output from StackProfile_3d it is possible to create a graph from the value table.

With this approach it is also possible to customize the look of the graph using a graph text template which first must be created, see intructions in the code below.

    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)
0 Kudos