0

I'm trying to create elevation graphs from a set of line features and raster elevation file, while the Stack Profile tool from ArcMap can do that, I need to modify the min/max values of the y-axis to make them uniform. I know I can manually change the values but I need to be able to automate the process of changing those values.

I have looked all over to find if there's way to do that, and the closest answer I got was the addSeriesBarMinMax function, which does not work for my graph. This is a test run of the code:

import arcpy
from arcpy import env

env.workspace="D:"

graph="test1.grf"
output_graph="test.grf"

graph=arcpy.Graph()

graph.addSeriesBarMinMax(graph, 400, 510)
arcpy.SaveGraph_management(graph,output_graph)

And I get this error:

  arcpy.SaveGraph_management(graph,output_graph)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\management.py", line 5473, in SaveGraph
    raise e
RuntimeError: Object: Error in executing tool

Is there any way for me to modify the min/max y-values from ArcPy?

  • 1
    Try setting workspace to r"D:\" – BERA Mar 21 '17 at 20:57
  • No.... it gives me the exact same error. Thanks though – KieraS Mar 21 '17 at 21:04
  • 1
    Welcome to GIS SE! As a new user please take the tour to learn about our focused Q&A format. – Midavalo Mar 22 '17 at 13:01
1

It looks like you are losing your reference to test1.grf. Try naming one of your parameters differently, such as using input_graph as your input variable name.

import arcpy

arcpy.env.workspace = r"D:"

input_graph = "test1.grf"
output_graph = "test.grf"

graph = arcpy.Graph()

graph.addSeriesBarMinMax(input_graph, 400, 510)
arcpy.SaveGraph_management(graph,output_graph)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.