Struggling to Make Graph

587
3
06-14-2012 12:24 PM
StephenFricke
New Contributor III
Hello,

I am attempting to learn how to make a graph using arcpy.  I created a vertical bar template and I am trying to make a bar graph of some precipitation data.  I keep getting an error of "<class 'arcgisscripting.ExecuteError'>: Failed to execute. Parameters are not valid.
ERROR 001020: Input series error. Incompatible parameter list.
Click 'Always reset parameters...' check-box to reset parameters.
Failed to execute (MakeGraph).

I am not even sure were this "Always reset parameters..." check-box is???

Here is a very simple code that I wrote that I can't get to work. 
# Import system modules
import arcpy
from arcpy import env
 
# Set environment settings
env.workspace = "c:/reacch/graphs"

# Set local variables
output_graph_name = "1910precip"
verticalBarGraph_bmp = "C:/reacch/graphs/1910precip.bmp"
graph_grf = "standard_bar.tee"
inputData = "C:/reacch/climate maps/precip1910" 
# Create the graph
graph = arcpy.Graph()

# Add a vertical bar series to the graph
graph.addSeriesBarVertical(inputData, "COUNT")


# Execute MakeGraph to create a Vertical Bar graph
arcpy.MakeGraph_management(graph_grf,graph,"Precip")
arcpy.SaveGraph_management(output_graph_name, verticalBarGraph_bmp)


Any help would be very much appreciated!!!
Tags (2)
0 Kudos
3 Replies
ChrisBater
New Contributor II
You may want to check out matplotlib, which is a python library for plotting.

http://matplotlib.sourceforge.net/gallery.html

The gallery includes code with the examples.

Chris
0 Kudos
StephenFricke
New Contributor III
Thanks for the response.  I would like to learn how to make these graphs through arcpy though.  I am no longer getting an error now, but I can't seem to figure out how to add input data to the graph template.  Here is my easy script for a vertical bar graph of population in various cities, in a cities point file.  When I run the script it just saves a blank vertical bar graph template, without the population data from the cities being input at all. 

import arcpy
# Set local variables:
inputTemplate = "C:/reacch/graphs/VerticalBarTemplate.tee"
inputdata=arcpy.GetParameterAsText(0)
# Add a vertical bar series to the graph
graph= arcpy.Graph()
graph.addSeriesBarVertical(inputdata, "POP2000")

# Output a graph, which is created in-memory
arcpy.MakeGraph_management(inputTemplate, graph, "city_pop")
arcpy.AddMessage("here")
# Save the graph as an image
arcpy.SaveGraph_management("city_pop","C:/reacch/graphs/city_pop.jpg")


If anyone knows why the input data is not being loaded into the graph template please let me know.  Thank you in advance!
0 Kudos
AnaMartins
New Contributor
Hello,
I'm trying to create a script with arcpy but appears the same error message. Could you help me please?




Hello,

I am attempting to learn how to make a graph using arcpy.  I created a vertical bar template and I am trying to make a bar graph of some precipitation data.  I keep getting an error of "<class 'arcgisscripting.ExecuteError'>: Failed to execute. Parameters are not valid.
ERROR 001020: Input series error. Incompatible parameter list.
Click 'Always reset parameters...' check-box to reset parameters.
Failed to execute (MakeGraph).

I am not even sure were this "Always reset parameters..." check-box is???

Here is a very simple code that I wrote that I can't get to work. 
# Import system modules
import arcpy
from arcpy import env
 
# Set environment settings
env.workspace = "c:/reacch/graphs"

# Set local variables
output_graph_name = "1910precip"
verticalBarGraph_bmp = "C:/reacch/graphs/1910precip.bmp"
graph_grf = "standard_bar.tee"
inputData = "C:/reacch/climate maps/precip1910" 
# Create the graph
graph = arcpy.Graph()

# Add a vertical bar series to the graph
graph.addSeriesBarVertical(inputData, "COUNT")


# Execute MakeGraph to create a Vertical Bar graph
arcpy.MakeGraph_management(graph_grf,graph,"Precip")
arcpy.SaveGraph_management(output_graph_name, verticalBarGraph_bmp)


Any help would be very much appreciated!!!
0 Kudos