Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am writing a tool in python which passes parameters to a R script, which in turn creates a DBF file. I read this DBF and want to make a histogram out of the data inside ArcMap as one of the results of the tool.

The code snippet is as follows:

import arcpy

simloglkhd = "H:\\CIV\\KULLDORFF\\DATA\\PLOTDATA.dbf"
inputTemplate = "C:\\Program Files (x86)\\ArcGIS\\Desktop10.1\\GraphTemplates\\Default.SimplifiedChinese.tee"
output_graph_name = "VerticalBarGraph1"
verticalBarGraph_bmp = "H:\\CIV\\KULLDORFF\\DATA\\plotdata1.bmp"
# Create the graph
graph = arcpy.Graph()

# Add a vertical bar series to the graph
graph.addSeriesHistogram(simloglkhd, "simloglkhd",10)

# Specify the title of the left axis
graph.graphAxis[0] = "Frequency"

# Specify the title of the bottom axis
graph.graphAxis[2] = "log(lambda)"

# Specify the title of the Graph
graph.graphPropsGeneral.title = "Monte Carlo Distribution of Lambda"

# Output a graph, which is created in-memory
arcpy.MakeGraph_management(inputTemplate, graph, output_graph_name)

# Save the graph as an image
arcpy.SaveGraph_management(output_graph_name, verticalBarGraph_bmp, "MAINTAIN_ASPECT_RATIO", "600", "375")

I am having the following difficulties:

  1. I am not able to find a template for this histogram. In the GraphTemplates folder there is PopulationPyramid, but it is still not working. Is there somewhere I can find templates. The create template operation gives a text file instead of a .tee file.

  2. I get an error in the line where I addSeriesHistogram saying "Field '10' is not in the dbf"(something like this) while it is only the countBin. Please can someone tell me where I can find good examples of the usage of this function.

My dbf file is simple ID(1-999) & simloglkhd(floating point numbers).

I really do not know how use this MakeGraph and addSeries_ . I have already read the ArcGIS help. Can you guide me to some more examples and documentation?

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.