AnsweredAssumed Answered

How to plot two lines in a graph?

Question asked by junzai618 on Dec 12, 2016
Latest reply on Dec 12, 2016 by junzai618

I'm trying to create a an arctool with two inputs: a line feature and multiple layer. I want the tool to do the StackProfile and display the profile of this line feature on the multiple layers in a graph, so that I can compare the difference. Here are some codes:

graph = arcpy.Graph()

num = 0

for profileTarget in profileTargets:

      profileTable = "test" + str(num)

      target = profileTarget.name

      arcpy.ddd.StackProfile( profileLine, target, profileTable)

      graph.addSeriesLineVertical( profileTable, "FIRST_Z", "FIRST_DIST")

      num += 1

 

graphName = "VerticalBarGraph"

arcpy.manegement.MakeGraph( inputTemplate, graph, graphName)

graphFile = "test.png"

arcpy.management.SaveGraph( graphName, graphFile)

 

When there is only one surface layer, it works fine. But an error occured when there are more than one layer at MakeGraph function, it seems a arcpy.Graph can't have two vertical lines displayed. Anyone has ideas about this or some other solution can I use?

Outcomes